KiCad PCB EDA Suite
PCB_POINT_EDITOR Class Reference

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

#include <pcb_point_editor.h>

Inheritance diagram for PCB_POINT_EDITOR:
PCB_TOOL_BASE TOOL_INTERACTIVE TOOL_BASE

Public Types

enum  RESET_REASON { RUN , MODEL_RELOAD , GAL_SWITCH , REDRAW }
 Determine the reason of reset for a tool. More...
 

Public Member Functions

 PCB_POINT_EDITOR ()
 
void Reset (RESET_REASON aReason) override
 Bring the tool to a known, initial state. More...
 
bool Init () override
 Init() is called once upon a registration of the tool. More...
 
int OnSelectionChange (const TOOL_EVENT &aEvent)
 Change selection event handler. More...
 
bool HasPoint ()
 Indicate the cursor is over an edit point. More...
 
void SetIsFootprintEditor (bool aEnabled)
 Function SetIsFootprintEditor() More...
 
bool IsFootprintEditor () const
 
void SetIsBoardEditor (bool aEnabled)
 
bool IsBoardEditor () const
 
virtual bool Is45Limited () const
 Should the tool use its 45° mode option? More...
 
void Activate ()
 Run the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Assign a context menu and tells when it should be activated. More...
 
void RunMainStack (std::function< void()> aFunc)
 Call a function using the main stack. More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Define which state (aStateFunc) to go when a certain event arrives (aConditions). More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Suspend execution of the tool until an event specified in aEventList arrives. More...
 
TOOL_TYPE GetType () const
 Return the type of the tool. More...
 
TOOL_ID GetId () const
 Return the unique identifier of the tool. More...
 
const std::string & GetName () const
 Return the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Return the instance of TOOL_MANAGER that takes care of the tool. More...
 
bool IsToolActive () const
 

Protected Types

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

Protected Member Functions

void doInteractiveItemPlacement (const TOOL_EVENT &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
 
FOOTPRINTfootprint () const
 
PCBNEW_SETTINGS::DISPLAY_OPTIONSdisplayOptions () const
 
PCB_DRAW_PANEL_GALcanvas () const
 
const PCB_SELECTIONselection () const
 
PCB_SELECTIONselection ()
 
void attachManager (TOOL_MANAGER *aManager)
 Set the TOOL_MANAGER the tool will belong to. More...
 
KIGFX::VIEWgetView () const
 Returns the instance of #VIEW object used in the application. More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Return the instance of VIEW_CONTROLS object used in the application. More...
 
template<typename T >
T * getEditFrame () const
 Return the application window object, casted to requested user type. More...
 
template<typename T >
T * getModel () const
 Return the model object if it matches the requested type. More...
 

Protected Attributes

bool m_isFootprintEditor
 
bool m_isBoardEditor
 
TOOL_MENU m_menu
 The functions below are not yet implemented - their interface may change. More...
 
TOOL_TYPE m_type
 Unique identifier for the tool, assigned by a TOOL_MANAGER instance. More...
 
TOOL_ID m_toolId
 Name of the tool. More...
 
std::string m_toolName
 
TOOL_MANAGERm_toolMgr
 

Private Member Functions

void setTransitions () override
 < Set up handlers for various events. More...
 
void buildForPolyOutline (std::shared_ptr< EDIT_POINTS > points, const SHAPE_POLY_SET *aOutline)
 
std::shared_ptr< EDIT_POINTSmakePoints (EDA_ITEM *aItem)
 Update item's points with edit points. More...
 
void updateItem () const
 
bool validatePolygon (SHAPE_POLY_SET &aModified) const
 Validate a polygon and displays a popup warning if invalid. More...
 
void updatePoints ()
 Update which point is being edited. More...
 
void updateEditedPoint (const TOOL_EVENT &aEvent)
 Set the current point being edited. NULL means none. More...
 
void setEditedPoint (EDIT_POINT *aPoint)
 
int getEditedPointIndex () const
 Return true if aPoint is the currently modified point. More...
 
bool isModified (const EDIT_POINT &aPoint) const
 
void pinEditedCorner (VECTOR2I &aTopLeft, VECTOR2I &aTopRight, VECTOR2I &aBotLeft, VECTOR2I &aBotRight, const VECTOR2I &aHole={ 0, 0 }, const VECTOR2I &aHoleSize={ 0, 0 }) const
 Set up an alternative constraint (typically enabled upon a modifier key being pressed). More...
 
void setAltConstraint (bool aEnabled)
 Return a point that should be used as a constrainer for 45 degrees mode. More...
 
EDIT_POINT get45DegConstrainer () const
 Condition to display "Create corner" context menu entry. More...
 
bool removeCornerCondition (const SELECTION &aSelection)
 
int addCorner (const TOOL_EVENT &aEvent)
 TOOL_ACTION handlers. More...
 
int removeCorner (const TOOL_EVENT &aEvent)
 
int modifiedSelection (const TOOL_EVENT &aEvent)
 
void editArcEndpointKeepTangent (PCB_SHAPE *aArc, const VECTOR2I &aCenter, const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd, const VECTOR2I &aCursor) const
 Move an end point of the arc, while keeping the tangent at the other endpoint. More...
 
void editArcEndpointKeepCenter (PCB_SHAPE *aArc, const VECTOR2I &aCenter, const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd, const VECTOR2I &aCursor) const
 Move an end point of the arc around the circumference. More...
 
void editArcCenterKeepEndpoints (PCB_SHAPE *aArc, const VECTOR2I &aCenter, const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd) const
 Move the arc center but keep endpoint locations. More...
 
void editArcMidKeepEndpoints (PCB_SHAPE *aArc, const VECTOR2I &aStart, const VECTOR2I &aEnd, const VECTOR2I &aCursor) const
 Move the mid point of the arc, while keeping the two endpoints. More...
 
void editArcMidKeepCenter (PCB_SHAPE *aArc, const VECTOR2I &aCenter, const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd, const VECTOR2I &aCursor) const
 Move the mid point of the arc, while keeping the angle. More...
 
int changeArcEditMode (const TOOL_EVENT &aEvent)
 
void resetTransitions ()
 Clear the current transition map and restores the default one created by setTransitions(). More...
 
void goInternal (TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)
 
EDA_ITEMgetModelInt () const
 
TOOLS_HOLDERgetToolHolderInt () const
 

Static Private Member Functions

static bool addCornerCondition (const SELECTION &aSelection)
 Determine if the tool can currently add a corner to the given item. More...
 
static bool canAddCorner (const EDA_ITEM &aItem)
 Condition to display "Remove corner" context menu entry. More...
 

Private Attributes

PCB_SELECTION_TOOLm_selectionTool
 
std::unique_ptr< STATUS_TEXT_POPUPm_statusPopup
 
std::shared_ptr< EDIT_POINTSm_editPoints
 
EDIT_POINTm_editedPoint
 
EDIT_POINTm_hoveredPoint
 
EDIT_POINT m_original
 Original position for the current drag point. More...
 
bool m_refill
 
ARC_EDIT_MODE m_arcEditMode
 
std::shared_ptr< EDIT_CONSTRAINT< EDIT_POINT > > m_altConstraint
 
EDIT_POINT m_altConstrainer
 

Static Private Attributes

static const unsigned int COORDS_PADDING = pcbIUScale.mmToIU( 20 )
 

Detailed Description

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

Definition at line 44 of file pcb_point_editor.h.

Member Enumeration Documentation

◆ INTERACTIVE_PLACEMENT_OPTIONS

Options for placing items interactively.

Enumerator
IPO_ROTATE 

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

IPO_FLIP 

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

IPO_SINGLE_CLICK 

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

IPO_REPEAT 

Allow repeat placement of the item.

Definition at line 121 of file pcb_tool_base.h.

121 {
123 IPO_ROTATE = 0x01,
124
126 IPO_FLIP = 0x02,
127
130 IPO_SINGLE_CLICK = 0x04,
131
133 IPO_REPEAT = 0x08
134 };
@ IPO_FLIP
Handle flip action in the loop by calling the item's flip method.
@ IPO_ROTATE
Handle the rotate action in the loop by calling the item's rotate method.
@ IPO_SINGLE_CLICK
Create an item immediately on placement starting, otherwise show the pencil cursor until the item is ...
@ IPO_REPEAT
Allow repeat placement of the item.

◆ RESET_REASON

enum TOOL_BASE::RESET_REASON
inherited

Determine 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.

REDRAW 

Full drawing refresh.

Definition at line 77 of file tool_base.h.

78 {
79 RUN,
82 REDRAW
83 };
@ REDRAW
Full drawing refresh.
Definition: tool_base.h:82
@ MODEL_RELOAD
Model changes (required full reload)
Definition: tool_base.h:80
@ GAL_SWITCH
Rendering engine changes.
Definition: tool_base.h:81
@ RUN
Tool is invoked after being inactive.
Definition: tool_base.h:79

Constructor & Destructor Documentation

◆ PCB_POINT_EDITOR()

PCB_POINT_EDITOR::PCB_POINT_EDITOR ( )

Definition at line 106 of file pcb_point_editor.cpp.

106 :
107 PCB_TOOL_BASE( "pcbnew.PointEditor" ),
108 m_selectionTool( nullptr ),
109 m_editedPoint( nullptr ),
110 m_hoveredPoint( nullptr ),
111 m_original( VECTOR2I( 0, 0 ) ),
112 m_refill( false ),
114 m_altConstrainer( VECTOR2I( 0, 0 ) )
115{
116}
@ KEEP_CENTER_ADJUST_ANGLE_RADIUS
EDIT_POINT * m_hoveredPoint
EDIT_POINT m_original
Original position for the current drag point.
EDIT_POINT m_altConstrainer
ARC_EDIT_MODE m_arcEditMode
EDIT_POINT * m_editedPoint
PCB_SELECTION_TOOL * m_selectionTool
PCB_TOOL_BASE(TOOL_ID aId, const std::string &aName)
Constructor.
Definition: pcb_tool_base.h:77
VECTOR2< int > VECTOR2I
Definition: vector2d.h:590

References KEEP_CENTER_ADJUST_ANGLE_RADIUS.

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Run 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:215
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:210
bool InvokeTool(TOOL_ID aToolId)
Call 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(), SCH_EDIT_TOOL::DeleteItemCursor(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), PCB_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), EE_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_POINT_EDITOR::Main(), PCB_PICKER_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), OnSelectionChange(), GROUP_TOOL::PickNewMember(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), ROUTER_TOOL::RouteSelected(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ addCorner()

int PCB_POINT_EDITOR::addCorner ( const TOOL_EVENT aEvent)
private

TOOL_ACTION handlers.

Definition at line 2198 of file pcb_point_editor.cpp.

2199{
2200 if( !m_editPoints )
2201 return 0;
2202
2203 EDA_ITEM* item = m_editPoints->GetParent();
2204 PCB_BASE_EDIT_FRAME* frame = getEditFrame<PCB_BASE_EDIT_FRAME>();
2205 const VECTOR2I& cursorPos = getViewControls()->GetCursorPosition();
2206
2207 // called without an active edited polygon
2208 if( !item || !canAddCorner( *item ) )
2209 return 0;
2210
2211 PCB_SHAPE* graphicItem = dynamic_cast<PCB_SHAPE*>( item );
2212 BOARD_COMMIT commit( frame );
2213
2214 if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T
2215 || ( graphicItem && graphicItem->GetShape() == SHAPE_T::POLY ) )
2216 {
2217 unsigned int nearestIdx = 0;
2218 unsigned int nextNearestIdx = 0;
2219 unsigned int nearestDist = INT_MAX;
2220 unsigned int firstPointInContour = 0;
2221 SHAPE_POLY_SET* zoneOutline;
2222
2223 if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T )
2224 {
2225 ZONE* zone = static_cast<ZONE*>( item );
2226 zoneOutline = zone->Outline();
2227 zone->SetNeedRefill( true );
2228 }
2229 else
2230 {
2231 zoneOutline = &( graphicItem->GetPolyShape() );
2232 }
2233
2234 commit.Modify( item );
2235
2236 // Search the best outline segment to add a new corner
2237 // and therefore break this segment into two segments
2238
2239 // Object to iterate through the corners of the outlines (main contour and its holes)
2240 SHAPE_POLY_SET::ITERATOR iterator = zoneOutline->Iterate( 0, zoneOutline->OutlineCount()-1,
2241 /* IterateHoles */ true );
2242 int curr_idx = 0;
2243
2244 // Iterate through all the corners of the outlines and search the best segment
2245 for( ; iterator; iterator++, curr_idx++ )
2246 {
2247 int jj = curr_idx+1;
2248
2249 if( iterator.IsEndContour() )
2250 { // We reach the last point of the current contour (main or hole)
2251 jj = firstPointInContour;
2252 firstPointInContour = curr_idx+1; // Prepare next contour analysis
2253 }
2254
2255 SEG curr_segment( zoneOutline->CVertex( curr_idx ), zoneOutline->CVertex( jj ) );
2256
2257 unsigned int distance = curr_segment.Distance( cursorPos );
2258
2259 if( distance < nearestDist )
2260 {
2261 nearestDist = distance;
2262 nearestIdx = curr_idx;
2263 nextNearestIdx = jj;
2264 }
2265 }
2266
2267 // Find the point on the closest segment
2268 const VECTOR2I& sideOrigin = zoneOutline->CVertex( nearestIdx );
2269 const VECTOR2I& sideEnd = zoneOutline->CVertex( nextNearestIdx );
2270 SEG nearestSide( sideOrigin, sideEnd );
2271 VECTOR2I nearestPoint = nearestSide.NearestPoint( cursorPos );
2272
2273 // Do not add points that have the same coordinates as ones that already belong to polygon
2274 // instead, add a point in the middle of the side
2275 if( nearestPoint == sideOrigin || nearestPoint == sideEnd )
2276 nearestPoint = ( sideOrigin + sideEnd ) / 2;
2277
2278 zoneOutline->InsertVertex( nextNearestIdx, nearestPoint );
2279
2280 // We re-hatch the filled zones but not polygons
2281 if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T )
2282 static_cast<ZONE*>( item )->HatchBorder();
2283
2284
2285 commit.Push( _( "Add a zone corner" ) );
2286 }
2287 else if( graphicItem && graphicItem->GetShape() == SHAPE_T::SEGMENT )
2288 {
2289 commit.Modify( graphicItem );
2290
2291 SEG seg( graphicItem->GetStart(), graphicItem->GetEnd() );
2292 VECTOR2I nearestPoint = seg.NearestPoint( cursorPos );
2293
2294 // Move the end of the line to the break point..
2295 graphicItem->SetEnd( VECTOR2I( nearestPoint.x, nearestPoint.y ) );
2296
2297 if( graphicItem->Type() == PCB_FP_SHAPE_T )
2298 static_cast<FP_SHAPE*>( graphicItem )->SetLocalCoord();
2299
2300 // and add another one starting from the break point
2301 PCB_SHAPE* newSegment;
2302
2303 if( item->Type() == PCB_FP_SHAPE_T )
2304 {
2305 FP_SHAPE* edge = static_cast<FP_SHAPE*>( graphicItem );
2306 assert( edge->GetParent()->Type() == PCB_FOOTPRINT_T );
2307 newSegment = new FP_SHAPE( *edge );
2308 }
2309 else
2310 {
2311 newSegment = new PCB_SHAPE( *graphicItem );
2312 }
2313
2314 newSegment->ClearSelected();
2315 newSegment->SetStart( VECTOR2I( nearestPoint.x, nearestPoint.y ) );
2316 newSegment->SetEnd( VECTOR2I( seg.B.x, seg.B.y ) );
2317
2318 if( newSegment->Type() == PCB_FP_SHAPE_T )
2319 static_cast<FP_SHAPE*>( newSegment )->SetLocalCoord();
2320
2321 commit.Add( newSegment );
2322 commit.Push( _( "Split segment" ) );
2323 }
2324
2325 updatePoints();
2326 return 0;
2327}
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:175
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
void ClearSelected()
Definition: eda_item.h:118
SHAPE_POLY_SET & GetPolyShape()
Definition: eda_shape.h:247
SHAPE_T GetShape() const
Definition: eda_shape.h:113
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
Definition: eda_shape.h:145
void SetStart(const VECTOR2I &aStart)
Definition: eda_shape.h:124
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
Definition: eda_shape.h:120
void SetEnd(const VECTOR2I &aEnd)
Definition: eda_shape.h:149
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
Common, abstract interface for edit frames.
static bool canAddCorner(const EDA_ITEM &aItem)
Condition to display "Remove corner" context menu entry.
void updatePoints()
Update which point is being edited.
std::shared_ptr< EDIT_POINTS > m_editPoints
PCB_BASE_EDIT_FRAME * frame() const
Definition: seg.h:42
Base class for iterating over all vertices in a given SHAPE_POLY_SET.
Represent a set of closed polygons.
void InsertVertex(int aGlobalIndex, const VECTOR2I &aNewVertex)
Adds a vertex in the globally indexed position aGlobalIndex.
ITERATOR Iterate(int aFirst, int aLast, bool aIterateHoles=false)
Return an object to iterate through the points of the polygons between aFirst and aLast.
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the aGlobalIndex-th vertex in the poly set.
int OutlineCount() const
Return the number of vertices in a given outline/hole.
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
void SetNeedRefill(bool aNeedRefill)
Definition: zone.h:246
void HatchBorder()
Compute the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_bor...
Definition: zone.cpp:861
SHAPE_POLY_SET * Outline()
Definition: zone.h:318
#define _(s)
static float distance(const SFVEC2UI &a, const SFVEC2UI &b)
@ PCB_FP_SHAPE_T
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:94
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition: typeinfo.h:112
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition: typeinfo.h:86
@ PCB_FP_ZONE_T
class ZONE, managed by a footprint
Definition: typeinfo.h:100

References _, COMMIT::Add(), SEG::B, canAddCorner(), EDA_ITEM::ClearSelected(), SHAPE_POLY_SET::CVertex(), SEG::Distance(), distance(), PCB_TOOL_BASE::frame(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), EDA_SHAPE::GetEnd(), BOARD_ITEM::GetParent(), EDA_SHAPE::GetPolyShape(), EDA_SHAPE::GetShape(), EDA_SHAPE::GetStart(), TOOL_BASE::getViewControls(), ZONE::HatchBorder(), SHAPE_POLY_SET::InsertVertex(), SHAPE_POLY_SET::ITERATOR_TEMPLATE< T >::IsEndContour(), SHAPE_POLY_SET::Iterate(), m_editPoints, COMMIT::Modify(), SEG::NearestPoint(), ZONE::Outline(), SHAPE_POLY_SET::OutlineCount(), PCB_FOOTPRINT_T, PCB_FP_SHAPE_T, PCB_FP_ZONE_T, PCB_ZONE_T, POLY, BOARD_COMMIT::Push(), SEGMENT, EDA_SHAPE::SetEnd(), ZONE::SetNeedRefill(), EDA_SHAPE::SetStart(), EDA_ITEM::Type(), updatePoints(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by setTransitions().

◆ addCornerCondition()

bool PCB_POINT_EDITOR::addCornerCondition ( const SELECTION aSelection)
staticprivate

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

Definition at line 2115 of file pcb_point_editor.cpp.

2116{
2117 if( aSelection.Size() != 1 )
2118 return false;
2119
2120 const EDA_ITEM* item = aSelection.Front();
2121
2122 return ( item != nullptr ) && canAddCorner( *item );
2123}
EDA_ITEM * Front() const
Definition: selection.h:208
int Size() const
Returns the number of selected parts.
Definition: selection.h:115

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

Referenced by Init().

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Set 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}

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ board()

BOARD * PCB_TOOL_BASE::board ( ) const
inlineprotectedinherited

Definition at line 170 of file pcb_tool_base.h.

170{ return getModel<BOARD>(); }

Referenced by PCB_CONTROL::AppendBoard(), BOARD_EDITOR_CONTROL::AssignNetclass(), AUTOPLACE_TOOL::autoplace(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), EDIT_TOOL::ChangeTrackWidth(), ZONE_FILLER_TOOL::CheckAllZones(), BOARD_INSPECTION_TOOL::ClearHighlight(), EDIT_TOOL::copyToClipboard(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), MICROWAVE_TOOL::createInductorBetween(), ROUTER_TOOL::CustomTrackWidthDialog(), PCB_CONTROL::DeleteItemCursor(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawShape(), PAD_TOOL::EnumeratePads(), PAD_TOOL::explodePad(), BOARD_EDITOR_CONTROL::ExportNetlist(), ZONE_FILLER_TOOL::FillAllZones(), EDIT_TOOL::FilletTracks(), PCB_TOOL_BASE::footprint(), GROUP_TOOL::Group(), ROUTER_TOOL::handleLayerSwitch(), BOARD_INSPECTION_TOOL::highlightNet(), ROUTER_TOOL::Init(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), PCB_CONTROL::LayerNext(), PCB_CONTROL::LayerPrev(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), EDIT_TOOL::MoveExact(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), PCB_CONTROL::Paste(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PAD_TOOL::PlacePad(), DRAWING_TOOL::PlaceText(), PCB_CONTROL::pruneItemLayers(), EDIT_TOOL::rebuildConnectivity(), ZONE_FILLER_TOOL::rebuildConnectivity(), PAD_TOOL::RecombinePad(), BOARD_EDITOR_CONTROL::RepairBoard(), FOOTPRINT_EDITOR_CONTROL::RepairFootprint(), PNS::TOOL_BASE::Reset(), PAD_TOOL::Reset(), PCB_CONTROL::Reset(), PCB_CONTROL::TrackDisplayMode(), PCB_CONTROL::unfilledZoneCheck(), GROUP_TOOL::Ungroup(), ROUTER_TOOL::UpdateMessagePanel(), ROUTER_TOOL::updateSizesAfterLayerSwitch(), PCB_CONTROL::ViaDisplayMode(), PCB_CONTROL::ZoneDisplayMode(), ZONE_FILLER_TOOL::ZoneFill(), ZONE_FILLER_TOOL::ZoneFillDirty(), BOARD_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfillAll().

◆ buildForPolyOutline()

void PCB_POINT_EDITOR::buildForPolyOutline ( std::shared_ptr< EDIT_POINTS points,
const SHAPE_POLY_SET aOutline 
)
private

Definition at line 144 of file pcb_point_editor.cpp.

146{
147 int cornersCount = aOutline->TotalVertices();
148
149 for( auto iterator = aOutline->CIterateWithHoles(); iterator; iterator++ )
150 {
151 points->AddPoint( *iterator );
152
153 if( iterator.IsEndContour() )
154 points->AddBreak();
155 }
156
157 // Lines have to be added after creating edit points, as they use EDIT_POINT references
158 for( int i = 0; i < cornersCount - 1; ++i )
159 {
160 if( points->IsContourEnd( i ) )
161 points->AddLine( points->Point( i ), points->Point( points->GetContourStartIdx( i ) ) );
162 else
163 points->AddLine( points->Point( i ), points->Point( i + 1 ) );
164
165 points->Line( i ).SetConstraint( new EC_PERPLINE( points->Line( i ) ) );
166 }
167
168 // The last missing line, connecting the last and the first polygon point
169 points->AddLine( points->Point( cornersCount - 1 ),
170 points->Point( points->GetContourStartIdx( cornersCount - 1 ) ) );
171
172 points->Line( points->LinesSize() - 1 )
173 .SetConstraint( new EC_PERPLINE( points->Line( points->LinesSize() - 1 ) ) );
174}
EDIT_CONSTRAINT for a EDIT_LINE, that constrains the line to move perpendicular to the line itself.
int TotalVertices() const
Delete aIdx-th polygon from the set.
CONST_ITERATOR CIterateWithHoles(int aOutline) const

References SHAPE_POLY_SET::CIterateWithHoles(), and SHAPE_POLY_SET::TotalVertices().

Referenced by makePoints().

◆ canAddCorner()

bool PCB_POINT_EDITOR::canAddCorner ( const EDA_ITEM aItem)
staticprivate

Condition to display "Remove corner" context menu entry.

Definition at line 2097 of file pcb_point_editor.cpp.

2098{
2099 const auto type = aItem.Type();
2100
2101 // Works only for zones and line segments
2102 if( type == PCB_ZONE_T || type == PCB_FP_ZONE_T )
2103 return true;
2104
2105 if( type == PCB_SHAPE_T || type == PCB_FP_SHAPE_T )
2106 {
2107 const PCB_SHAPE& shape = static_cast<const PCB_SHAPE&>( aItem );
2108 return shape.GetShape() == SHAPE_T::SEGMENT || shape.GetShape() == SHAPE_T::POLY;
2109 }
2110
2111 return false;
2112}
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:88

References EDA_SHAPE::GetShape(), PCB_FP_SHAPE_T, PCB_FP_ZONE_T, PCB_SHAPE_T, PCB_ZONE_T, POLY, SEGMENT, and EDA_ITEM::Type().

Referenced by addCorner(), and addCornerCondition().

◆ canvas()

◆ changeArcEditMode()

int PCB_POINT_EDITOR::changeArcEditMode ( const TOOL_EVENT aEvent)
private

Definition at line 2413 of file pcb_point_editor.cpp.

2414{
2415 PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
2416
2418 {
2419 if( editFrame->IsType( FRAME_PCB_EDITOR ) )
2421 else
2423
2424 switch( m_arcEditMode )
2425 {
2428 break;
2431 break;
2432 }
2433 }
2434 else
2435 {
2437 }
2438
2439 if( editFrame->IsType( FRAME_PCB_EDITOR ) )
2441 else
2443
2444 return 0;
2445}
ARC_EDIT_MODE
Settings for arc editing.
Definition: app_settings.h:70
@ KEEP_ENDPOINTS_OR_START_DIRECTION
static TOOL_ACTION cycleArcEditMode
Definition: actions.h:174
bool IsType(FRAME_T aType) const
ARC_EDIT_MODE m_ArcEditMode
PCBNEW_SETTINGS * GetPcbNewSettings() const
FOOTPRINT_EDITOR_SETTINGS * GetFootprintEditorSettings() const
TOOL_EVENT MakeEvent() const
Return the event associated with the action (i.e.
Definition: tool_action.cpp:72
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:442
bool Matches(const TOOL_EVENT &aEvent) const
Test whether two events match in terms of category & action or command.
Definition: tool_event.h:365
@ FRAME_PCB_EDITOR
Definition: frame_type.h:40

References ACTIONS::cycleArcEditMode, FRAME_PCB_EDITOR, PCB_BASE_FRAME::GetFootprintEditorSettings(), PCB_BASE_FRAME::GetPcbNewSettings(), EDA_BASE_FRAME::IsType(), KEEP_CENTER_ADJUST_ANGLE_RADIUS, KEEP_ENDPOINTS_OR_START_DIRECTION, FOOTPRINT_EDITOR_SETTINGS::m_ArcEditMode, PCBNEW_SETTINGS::m_ArcEditMode, m_arcEditMode, TOOL_ACTION::MakeEvent(), TOOL_EVENT::Matches(), and TOOL_EVENT::Parameter().

Referenced by setTransitions().

◆ controls()

◆ displayOptions()

◆ doInteractiveItemPlacement()

void PCB_TOOL_BASE::doInteractiveItemPlacement ( const TOOL_EVENT 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 41 of file pcb_tool_base.cpp.

44{
45 using namespace std::placeholders;
46 std::unique_ptr<BOARD_ITEM> newItem;
47
48 frame()->PushTool( aTool );
49
50 BOARD_COMMIT commit( frame() );
51
53
54 Activate();
55 // Must be done after Activate() so that it gets set into the correct context
56 controls()->ShowCursor( true );
57 controls()->ForceCursorPosition( false );
58 // do not capture or auto-pan until we start placing an item
59
60 PCB_GRID_HELPER grid( m_toolMgr, frame()->GetMagneticItemsSettings() );
61
62 // Add a VIEW_GROUP that serves as a preview for the new item
63 PCB_SELECTION preview;
64 view()->Add( &preview );
65
66 aPlacer->m_board = board();
67 aPlacer->m_frame = frame();
68 aPlacer->m_modifiers = 0;
69
70 auto makeNewItem =
71 [&]( VECTOR2I aPosition )
72 {
73 if( frame()->GetModel() )
74 newItem = aPlacer->CreateItem();
75
76 if( newItem )
77 {
78 newItem->SetPosition( aPosition );
79 preview.Add( newItem.get() );
80
81 if( newItem->Type() == PCB_FOOTPRINT_T )
82 {
83 FOOTPRINT* fp = dyn_cast<FOOTPRINT*>( newItem.get() );
84
85 // footprints have more drawable parts
86 fp->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Add, &preview, _1 ) );
87 }
88 }
89 };
90
91 if( aOptions & IPO_SINGLE_CLICK )
92 makeNewItem( controls()->GetCursorPosition() );
93
94 auto setCursor =
95 [&]()
96 {
97 if( !newItem )
99 else
101 };
102
103 // Set initial cursor
104 setCursor();
105
106 // Main loop: keep receiving events
107 while( TOOL_EVENT* evt = Wait() )
108 {
109 setCursor();
110
111 grid.SetSnap( false ); // Interactive placement tools need to set their own item snaps
112 grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
113 VECTOR2I cursorPos = grid.BestSnapAnchor( controls()->GetMousePosition(), nullptr );
114
115 aPlacer->m_modifiers = evt->Modifier();
116
117 auto cleanup =
118 [&] ()
119 {
120 newItem = nullptr;
121 preview.Clear();
122 view()->Update( &preview );
123 controls()->SetAutoPan( false );
124 controls()->CaptureCursor( false );
125 controls()->ShowCursor( true );
126 controls()->ForceCursorPosition( false );
127 };
128
129 if( evt->IsCancelInteractive() )
130 {
131 if( aOptions & IPO_SINGLE_CLICK )
132 {
133 cleanup();
134 frame()->PopTool( aTool );
135 break;
136 }
137 else if( newItem )
138 {
139 cleanup();
140 }
141 else
142 {
143 frame()->PopTool( aTool );
144 break;
145 }
146 }
147 else if( evt->IsActivate() )
148 {
149 if( newItem )
150 cleanup();
151
152 if( evt->IsPointEditor() )
153 {
154 // don't exit (the point editor runs in the background)
155 }
156 else if( evt->IsMoveTool() )
157 {
158 // leave ourselves on the stack so we come back after the move
159 break;
160 }
161 else
162 {
163 frame()->PopTool( aTool );
164 break;
165 }
166 }
167 else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) )
168 {
169 if( !newItem )
170 {
171 // create the item if possible
172 makeNewItem( cursorPos );
173
174 // no item created, so wait for another click
175 if( !newItem )
176 continue;
177
178 controls()->CaptureCursor( true );
179 controls()->SetAutoPan( true );
180 }
181 else
182 {
183 BOARD_ITEM* newBoardItem = newItem.release();
184 EDA_ITEM_FLAGS oldFlags = newBoardItem->GetFlags();
185
186 newBoardItem->ClearFlags();
187
188 if( !aPlacer->PlaceItem( newBoardItem, commit ) )
189 {
190 newBoardItem->SetFlags( oldFlags );
191 newItem.reset( newBoardItem );
192 continue;
193 }
194
195 preview.Clear();
196 commit.Push( aCommitMessage );
197
198 controls()->CaptureCursor( false );
199 controls()->SetAutoPan( false );
200 controls()->ShowCursor( true );
201
202 if( !( aOptions & IPO_REPEAT ) )
203 break;
204
205 if( aOptions & IPO_SINGLE_CLICK )
206 makeNewItem( controls()->GetCursorPosition() );
207
208 setCursor();
209 }
210 }
211 else if( evt->IsClick( BUT_RIGHT ) )
212 {
214 }
215 else if( evt->IsAction( &PCB_ACTIONS::trackViaSizeChanged ) )
216 {
218 }
219 else if( newItem && evt->Category() == TC_COMMAND )
220 {
221 /*
222 * Handle any events that can affect the item as we move it around
223 */
224 if( TOOL_EVT_UTILS::IsRotateToolEvt( *evt ) && ( aOptions & IPO_ROTATE ) )
225 {
226 EDA_ANGLE rotationAngle = TOOL_EVT_UTILS::GetEventRotationAngle( *frame(), *evt );
227 newItem->Rotate( newItem->GetPosition(), rotationAngle );
228 view()->Update( &preview );
229 }
230 else if( evt->IsAction( &PCB_ACTIONS::flip ) && ( aOptions & IPO_FLIP ) )
231 {
232 newItem->Flip( newItem->GetPosition(), frame()->GetPcbNewSettings()->m_FlipLeftRight );
233 view()->Update( &preview );
234 }
235 else if( evt->IsAction( &PCB_ACTIONS::properties ) )
236 {
237 frame()->OnEditItemRequest( newItem.get() );
238
239 // Notify other tools of the changes
241 }
242 else if( evt->IsAction( &ACTIONS::refreshPreview ) )
243 {
244 preview.Clear();
245 newItem.reset();
246
247 makeNewItem( cursorPos );
248 aPlacer->SnapItem( newItem.get() );
249 view()->Update( &preview );
250 }
251 else
252 {
253 evt->SetPassEvent();
254 }
255 }
256 else if( newItem && evt->IsMotion() )
257 {
258 // track the cursor
259 newItem->SetPosition( cursorPos );
260 aPlacer->SnapItem( newItem.get() );
261
262 // Show a preview of the item
263 view()->Update( &preview );
264 }
265 else
266 {
267 evt->SetPassEvent();
268 }
269 }
270
271 view()->Remove( &preview );
273 controls()->SetAutoPan( false );
274 controls()->CaptureCursor( false );
275 controls()->ForceCursorPosition( false );
276}
static TOOL_ACTION refreshPreview
Definition: actions.h:110
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:70
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:139
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:141
EDA_ITEM_FLAGS GetFlags() const
Definition: eda_item.h:142
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition: actions.h:214
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction) const
Invoke a function on all BOARD_ITEMs that belong to the footprint (pads, drawings,...
Definition: footprint.cpp:1393
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: pcb_view.cpp:92
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Add a VIEW_ITEM to the view.
Definition: pcb_view.cpp:58
virtual void Remove(VIEW_ITEM *aItem) override
Remove a VIEW_ITEM from the view.
Definition: pcb_view.cpp:75
virtual void CaptureCursor(bool aEnabled)
Force the cursor to stay within the drawing panel area.
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Place the cursor immediately at a given point.
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
virtual void Add(VIEW_ITEM *aItem)
Add an item to the group.
Definition: view_group.cpp:57
static TOOL_ACTION trackViaSizeChanged
Definition: pcb_actions.h:338
static TOOL_ACTION properties
Activation of the edit tool.
Definition: pcb_actions.h:149
static TOOL_ACTION selectionClear
Clear the current selection.
Definition: pcb_actions.h:59
static TOOL_ACTION flip
Flipping of selected objects.
Definition: pcb_actions.h:126
virtual void OnEditItemRequest(BOARD_ITEM *aItem)=0
Install the corresponding dialog editor for the given item.
virtual BOARD_ITEM_CONTAINER * GetModel() const =0
KIGFX::PCB_VIEW * view() const
KIGFX::VIEW_CONTROLS * controls() const
BOARD * board() const
const PCB_SELECTION & selection() const
virtual void Add(EDA_ITEM *aItem)
Definition: selection.cpp:42
virtual void Clear() override
Remove all the stored items from the group.
Definition: selection.h:92
virtual void PopTool(const TOOL_EVENT &aEvent)
Pops a tool from the stack.
virtual void PushTool(const TOOL_EVENT &aEvent)
NB: the definition of "tool" is different at the user level.
TOOL_MANAGER * GetManager() const
Return the instance of TOOL_MANAGER that takes care of the tool.
Definition: tool_base.h:144
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
Generic, UI-independent tool event.
Definition: tool_event.h:156
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Suspend execution of the tool until an event specified in aEventList arrives.
void Activate()
Run the tool.
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:142
void ShowContextMenu(SELECTION &aSelection)
Helper function to set and immediately show a CONDITIONAL_MENU in concert with the given SELECTION.
Definition: tool_menu.cpp:57
std::uint32_t EDA_ITEM_FLAGS
EDA_ANGLE GetEventRotationAngle(const PCB_BASE_EDIT_FRAME &aFrame, const TOOL_EVENT &aEvent)
Function getEventRotationAngle()
bool IsRotateToolEvt(const TOOL_EVENT &aEvt)
Function isRotateToolEvt()
virtual void SnapItem(BOARD_ITEM *aItem)
PCB_BASE_EDIT_FRAME * m_frame
Definition: pcb_tool_base.h:64
virtual std::unique_ptr< BOARD_ITEM > CreateItem()=0
virtual bool PlaceItem(BOARD_ITEM *aItem, BOARD_COMMIT &aCommit)
@ TC_COMMAND
Definition: tool_event.h:52
@ BUT_LEFT
Definition: tool_event.h:127
@ BUT_RIGHT
Definition: tool_event.h:128

References TOOL_INTERACTIVE::Activate(), SELECTION::Add(), KIGFX::VIEW_GROUP::Add(), KIGFX::PCB_VIEW::Add(), ARROW, PCB_TOOL_BASE::board(), BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_CONTROLS::CaptureCursor(), SELECTION::Clear(), EDA_ITEM::ClearFlags(), PCB_TOOL_BASE::controls(), INTERACTIVE_PLACER_BASE::CreateItem(), PCB_ACTIONS::flip, KIGFX::VIEW_CONTROLS::ForceCursorPosition(), PCB_TOOL_BASE::frame(), PCB_BASE_FRAME::GetCanvas(), TOOL_EVT_UTILS::GetEventRotationAngle(), EDA_ITEM::GetFlags(), TOOL_BASE::GetManager(), PCB_BASE_FRAME::GetModel(), TOOL_BASE::getView(), grid, 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, INTERACTIVE_PLACER_BASE::m_frame, TOOL_INTERACTIVE::m_menu, INTERACTIVE_PLACER_BASE::m_modifiers, TOOL_BASE::m_toolMgr, PCB_BASE_EDIT_FRAME::OnEditItemRequest(), PCB_FOOTPRINT_T, PENCIL, PLACE, INTERACTIVE_PLACER_BASE::PlaceItem(), TOOLS_HOLDER::PopTool(), TOOL_MANAGER::ProcessEvent(), PCB_ACTIONS::properties, BOARD_COMMIT::Push(), TOOLS_HOLDER::PushTool(), ACTIONS::refreshPreview, KIGFX::PCB_VIEW::Remove(), TOOL_MANAGER::RunAction(), FOOTPRINT::RunOnChildren(), EVENTS::SelectedItemsModified, PCB_TOOL_BASE::selection(), PCB_ACTIONS::selectionClear, KIGFX::VIEW_CONTROLS::SetAutoPan(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), EDA_ITEM::SetFlags(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), INTERACTIVE_PLACER_BASE::SnapItem(), TC_COMMAND, PCB_ACTIONS::trackViaSizeChanged, KIGFX::PCB_VIEW::Update(), PCB_TOOL_BASE::view(), and TOOL_INTERACTIVE::Wait().

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

◆ editArcCenterKeepEndpoints()

void PCB_POINT_EDITOR::editArcCenterKeepEndpoints ( PCB_SHAPE aArc,
const VECTOR2I aCenter,
const VECTOR2I aStart,
const VECTOR2I aMid,
const VECTOR2I aEnd 
) const
private

Move the arc center but keep endpoint locations.

Definition at line 824 of file pcb_point_editor.cpp.

827{
828 const int c_snapEpsilon_sq = 4;
829
830 VECTOR2I m = ( aStart / 2 + aEnd / 2 );
831 VECTOR2I perp = ( aEnd - aStart ).Perpendicular().Resize( INT_MAX / 2 );
832
833 SEG legal( m - perp, m + perp );
834
835 const SEG testSegments[] = { SEG( aCenter, aCenter + VECTOR2( 1, 0 ) ),
836 SEG( aCenter, aCenter + VECTOR2( 0, 1 ) ) };
837
838 std::vector<VECTOR2I> points = { legal.A, legal.B };
839
840 for( const SEG& seg : testSegments )
841 {
842 OPT_VECTOR2I vec = legal.IntersectLines( seg );
843
844 if( vec && legal.SquaredDistance( *vec ) <= c_snapEpsilon_sq )
845 points.push_back( *vec );
846 }
847
848 OPT_VECTOR2I nearest;
850
851 // Snap by distance between cursor and intersections
852 for( const VECTOR2I& pt : points )
853 {
854 SEG::ecoord d_sq = ( pt - aCenter ).SquaredEuclideanNorm();
855
856 if( d_sq < min_d_sq - c_snapEpsilon_sq )
857 {
858 min_d_sq = d_sq;
859 nearest = pt;
860 }
861 }
862
863 if( nearest )
864 aArc->SetCenter( *nearest );
865}
void SetCenter(const VECTOR2I &aCenter)
Definition: eda_shape.cpp:470
VECTOR2I A
Definition: seg.h:49
VECTOR2I::extended_type ecoord
Definition: seg.h:44
static constexpr extended_type ECOORD_MAX
Definition: vector2d.h:75
VECTOR2< T > Resize(T aNewLength) const
Return a vector of the same direction, but length specified in aNewLength.
Definition: vector2d.h:350
std::optional< VECTOR2I > OPT_VECTOR2I
Definition: seg.h:39

References SEG::A, SEG::B, VECTOR2< int >::ECOORD_MAX, SEG::IntersectLines(), VECTOR2< T >::Resize(), EDA_SHAPE::SetCenter(), and SEG::SquaredDistance().

Referenced by updateItem().

◆ editArcEndpointKeepCenter()

void PCB_POINT_EDITOR::editArcEndpointKeepCenter ( PCB_SHAPE aArc,
const VECTOR2I aCenter,
const VECTOR2I aStart,
const VECTOR2I aMid,
const VECTOR2I aEnd,
const VECTOR2I aCursor 
) const
private

Move an end point of the arc around the circumference.

Definition at line 980 of file pcb_point_editor.cpp.

984{
985 int minRadius = EDA_UNIT_UTILS::Mils2IU( pcbIUScale, 1 );
986 bool movingStart;
987
988 VECTOR2I p1, p2, prev_p1;
989
990 // user is moving p1, we want to move p2 to the new radius.
991
992 if( aStart != aArc->GetStart() )
993 {
994 prev_p1 = aArc->GetStart();
995 p1 = aStart;
996 p2 = aEnd;
997 movingStart = true;
998 }
999 else
1000 {
1001 prev_p1 = aArc->GetEnd();
1002 p1 = aEnd;
1003 p2 = aStart;
1004 movingStart = false;
1005 }
1006
1007 p1 = p1 - aCenter;
1008 p2 = p2 - aCenter;
1009
1010 if( p1.x == 0 && p1.y == 0 )
1011 p1 = prev_p1 - aCenter;
1012
1013 if( p2.x == 0 && p2.y == 0 )
1014 p2 = { 1, 0 };
1015
1016 double radius = p1.EuclideanNorm();
1017
1018 if( radius < minRadius )
1019 radius = minRadius;
1020
1021 p1 = aCenter + p1.Resize( radius );
1022 p2 = aCenter + p2.Resize( radius );
1023
1024 aArc->SetCenter( aCenter );
1025
1026 if( movingStart )
1027 {
1028 aArc->SetStart( p1 );
1029 aArc->SetEnd( p2 );
1030 }
1031 else
1032 {
1033 aArc->SetStart( p2 );
1034 aArc->SetEnd( p1 );
1035 }
1036}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:109
T EuclideanNorm() const
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
Definition: vector2d.h:265
constexpr int Mils2IU(const EDA_IU_SCALE &aIuScale, int mils)
Definition: eda_units.h:122

References VECTOR2< T >::EuclideanNorm(), EDA_SHAPE::GetEnd(), EDA_SHAPE::GetStart(), EDA_UNIT_UTILS::Mils2IU(), pcbIUScale, VECTOR2< T >::Resize(), EDA_SHAPE::SetCenter(), EDA_SHAPE::SetEnd(), EDA_SHAPE::SetStart(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by updateItem().

◆ editArcEndpointKeepTangent()

void PCB_POINT_EDITOR::editArcEndpointKeepTangent ( PCB_SHAPE aArc,
const VECTOR2I aCenter,
const VECTOR2I aStart,
const VECTOR2I aMid,
const VECTOR2I aEnd,
const VECTOR2I aCursor 
) const
private

Move an end point of the arc, while keeping the tangent at the other endpoint.

Definition at line 675 of file pcb_point_editor.cpp.

679{
680 VECTOR2I center = aCenter;
681 bool movingStart;
682 bool arcValid = true;
683
684 VECTOR2I p1, p2, p3;
685 // p1 does not move, p2 does.
686
687 if( aStart != aArc->GetStart() )
688 {
689 p1 = aEnd;
690 p2 = aStart;
691 p3 = aMid;
692 movingStart = true;
693 }
694 else if( aEnd != aArc->GetEnd() )
695 {
696 p1 = aStart;
697 p2 = aEnd;
698 p3 = aMid;
699 movingStart = false;
700 }
701 else
702 {
703 return;
704 }
705
706 VECTOR2D v1, v2, v3, v4;
707
708 // Move the coordinate system
709 v1 = p1 - aCenter;
710 v2 = p2 - aCenter;
711 v3 = p3 - aCenter;
712
713 VECTOR2D u1, u2, u3;
714
715 // A point cannot be both the center and on the arc.
716 if( ( v1.EuclideanNorm() == 0 ) || ( v2.EuclideanNorm() == 0 ) )
717 return;
718
719 u1 = v1 / v1.EuclideanNorm();
720 u2 = v3 - ( u1.x * v3.x + u1.y * v3.y ) * u1;
721 u2 = u2 / u2.EuclideanNorm();
722
723 // [ u1, u3 ] is a base centered on the circle with:
724 // u1 : unit vector toward the point that does not move
725 // u2 : unit vector toward the mid point.
726
727 // Get vectors v1, and v2 in that coordinate system.
728
729 double det = u1.x * u2.y - u2.x * u1.y;
730
731 // u1 and u2 are unit vectors, and perpendicular.
732 // det should not be 0. In case it is, do not change the arc.
733 if( det == 0 )
734 return;
735
736 double tmpx = v1.x * u2.y - v1.y * u2.x;
737 double tmpy = -v1.x * u1.y + v1.y * u1.x;
738 v1.x = tmpx;
739 v1.y = tmpy;
740 v1 = v1 / det;
741
742 tmpx = v2.x * u2.y - v2.y * u2.x;
743 tmpy = -v2.x * u1.y + v2.y * u1.x;
744 v2.x = tmpx;
745 v2.y = tmpy;
746 v2 = v2 / det;
747
748 double R = v1.EuclideanNorm();
749 bool transformCircle = false;
750
751 /* p2
752 * X***
753 * ** <---- This is the arc
754 * y ^ **
755 * | R *
756 * | <-----------> *
757 * x------x------>--------x p1
758 * C' <----> C x
759 * delta
760 *
761 * p1 does not move, and the tangent at p1 remains the same.
762 * => The new center, C', will be on the C-p1 axis.
763 * p2 moves
764 *
765 * The radius of the new circle is delta + R
766 *
767 * || C' p2 || = || C' P1 ||
768 * is the same as :
769 * ( delta + p2.x ) ^ 2 + p2.y ^ 2 = ( R + delta ) ^ 2
770 *
771 * delta = ( R^2 - p2.x ^ 2 - p2.y ^2 ) / ( 2 * p2.x - 2 * R )
772 *
773 * We can use this equation for any point p2 with p2.x < R
774 */
775
776 if( v2.x == R )
777 {
778 // Straight line, do nothing
779 }
780 else
781 {
782 if( v2.x > R )
783 {
784 // If we need to invert the curvature.
785 // We modify the input so we can use the same equation
786 transformCircle = true;
787 v2.x = 2 * R - v2.x;
788 }
789
790 // We can keep the tangent constraint.
791 double delta = ( R * R - v2.x * v2.x - v2.y * v2.y ) / ( 2 * v2.x - 2 * R );
792
793 // This is just to limit the radius, so nothing overflows later when drawing.
795 arcValid = false;
796
797 // Never recorded a problem, but still checking.
798 if( !std::isfinite( delta ) )
799 arcValid = false;
800
801 // v4 is the new center
802 v4 = ( !transformCircle ) ? VECTOR2D( -delta, 0 ) : VECTOR2D( 2 * R + delta, 0 );
803
804 tmpx = v4.x * u1.x + v4.y * u2.x;
805 tmpy = v4.x * u1.y + v4.y * u2.y;
806 v4.x = tmpx;
807 v4.y = tmpy;
808
809 center = v4 + aCenter;
810
811 if( arcValid )
812 {
813 aArc->SetCenter( center );
814
815 if( movingStart )
816 aArc->SetStart( aStart );
817 else
818 aArc->SetEnd( aEnd );
819 }
820 }
821}
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
T y
Definition: vector3.h:62
T EuclideanNorm() const
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
Definition: vector3.h:146
T x
Definition: vector3.h:61
double m_DrawArcCenterMaxAngle
When drawing an arc, the angle ( center - start ) - ( start - end ) can be limited to avoid extremely...
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:418
VECTOR3I v1(5, 5, 5)
VECTOR2I v2(1, 0)
Test suite for KiCad math code.
VECTOR3I v3(1, 1, 1)
constexpr int delta
VECTOR2< double > VECTOR2D
Definition: vector2d.h:589

References std::abs(), delta, VECTOR2< T >::EuclideanNorm(), VECTOR3< T >::EuclideanNorm(), ADVANCED_CFG::GetCfg(), EDA_SHAPE::GetEnd(), EDA_SHAPE::GetStart(), ADVANCED_CFG::m_DrawArcCenterMaxAngle, EDA_SHAPE::SetCenter(), EDA_SHAPE::SetEnd(), EDA_SHAPE::SetStart(), v1, v2, v3, VECTOR2< T >::x, VECTOR3< T >::x, VECTOR2< T >::y, and VECTOR3< T >::y.

Referenced by updateItem().

◆ editArcMidKeepCenter()

void PCB_POINT_EDITOR::editArcMidKeepCenter ( PCB_SHAPE aArc,
const VECTOR2I aCenter,
const VECTOR2I aStart,
const VECTOR2I aMid,
const VECTOR2I aEnd,
const VECTOR2I aCursor 
) const
private

Move the mid point of the arc, while keeping the angle.

Change the edit method for arcs.

Definition at line 1039 of file pcb_point_editor.cpp.

1042{
1043 int minRadius = EDA_UNIT_UTILS::Mils2IU( pcbIUScale, 1 );
1044
1045 SEG chord( aStart, aEnd );
1046
1047 // Now, update the edit point position
1048 // Express the point in a circle-centered coordinate system.
1049 VECTOR2I start = aStart - aCenter;
1050 VECTOR2I end = aEnd - aCenter;
1051
1052 double radius = ( aCursor - aCenter ).EuclideanNorm();
1053
1054 if( radius < minRadius )
1055 radius = minRadius;
1056
1057 start = start.Resize( radius );
1058 end = end.Resize( radius );
1059
1060 start = start + aCenter;
1061 end = end + aCenter;
1062
1063 aArc->SetStart( start );
1064 aArc->SetEnd( end );
1065}
double EuclideanNorm(const VECTOR2I &vector)
Definition: trigo.h:129

References EuclideanNorm(), EDA_UNIT_UTILS::Mils2IU(), pcbIUScale, VECTOR2< T >::Resize(), EDA_SHAPE::SetEnd(), and EDA_SHAPE::SetStart().

Referenced by updateItem().

◆ editArcMidKeepEndpoints()

void PCB_POINT_EDITOR::editArcMidKeepEndpoints ( PCB_SHAPE aArc,
const VECTOR2I aStart,
const VECTOR2I aEnd,
const VECTOR2I aCursor 
) const
private

Move the mid point of the arc, while keeping the two endpoints.

Definition at line 1068 of file pcb_point_editor.cpp.

1071{
1072 // Let 'm' be the middle point of the chord between the start and end points
1073 VECTOR2I m = ( aStart + aEnd ) / 2;
1074
1075 // Legal midpoints lie on a vector starting just off the chord midpoint and extending out
1076 // past the existing midpoint. We do not allow arc inflection while point editing.
1077 const int JUST_OFF = ( aStart - aEnd ).EuclideanNorm() / 100;
1078 VECTOR2I v = (VECTOR2I) aArc->GetArcMid() - m;
1079 SEG legal( m + v.Resize( JUST_OFF ), m + v.Resize( INT_MAX / 2 ) );
1080 VECTOR2I mid = legal.NearestPoint( aCursor );
1081
1082 aArc->SetArcGeometry( aStart, mid, aEnd );
1083}
void SetArcGeometry(const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd)
Set the three controlling points for an arc.
Definition: eda_shape.cpp:555
VECTOR2I GetArcMid() const
Definition: eda_shape.cpp:488

References EuclideanNorm(), EDA_SHAPE::GetArcMid(), SEG::NearestPoint(), VECTOR2< T >::Resize(), and EDA_SHAPE::SetArcGeometry().

Referenced by updateItem().

◆ footprint()

◆ frame()

PCB_BASE_EDIT_FRAME * PCB_TOOL_BASE::frame ( ) const
inlineprotectedinherited

Definition at line 165 of file pcb_tool_base.h.

166 {
167 return getEditFrame<PCB_BASE_EDIT_FRAME>();
168 }

Referenced by addCorner(), AUTOPLACE_TOOL::autoplace(), PCB_TOOL_BASE::canvas(), ZONE_FILLER_TOOL::CheckAllZones(), PNS::TOOL_BASE::checkSnap(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), ROUTER_TOOL::CustomTrackWidthDialog(), FOOTPRINT_EDITOR_CONTROL::DeleteFootprint(), EDIT_TOOL::DeleteItems(), PCB_TOOL_BASE::displayOptions(), BOARD_EDITOR_CONTROL::doCrossProbePcbToSch(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), ROUTER_TOOL::DpDimensionsDialog(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawShape(), DRAWING_TOOL::DrawVia(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EditPad(), PAD_TOOL::EnumeratePads(), PAD_TOOL::explodePad(), BOARD_EDITOR_CONTROL::ExportSpecctraDSN(), ZONE_FILLER_TOOL::FillAllZones(), EDIT_TOOL::FilletTracks(), ROUTER_TOOL::finishInteractive(), EDIT_TOOL::Flip(), PCB_CONTROL::FlipPcbView(), GLOBAL_EDIT_TOOL::GlobalDeletions(), ROUTER_TOOL::handleLayerSwitch(), PCB_CONTROL::HighContrastMode(), PCB_CONTROL::HighContrastModeCycle(), BOARD_INSPECTION_TOOL::HighlightItem(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), BOARD_EDITOR_CONTROL::ImportSpecctraSession(), SCRIPTING_TOOL::Init(), ROUTER_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), PCB_TOOL_BASE::Is45Limited(), PCB_PICKER_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::meanderSettingsDialog(), EDIT_TOOL::MoveExact(), PCB_CONTROL::NetColorModeCycle(), OnSelectionChange(), ROUTER_TOOL::onViaCommand(), PCB_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), GROUP_TOOL::PickNewMember(), PNS::TOOL_BASE::pickSingleItem(), BOARD_EDITOR_CONTROL::PlaceFootprint(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), PCB_CONTROL::pruneItemLayers(), PAD_TOOL::pushPadSettings(), PCB_CONTROL::RatsnestModeCycle(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), SCRIPTING_TOOL::reloadPlugins(), removeCorner(), PNS::TOOL_BASE::Reset(), PAD_TOOL::Reset(), EDIT_TOOL::Rotate(), ROUTER_TOOL::RouteSelected(), ROUTER_TOOL::SelectCopperLayerPair(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), setEditedPoint(), ROUTER_TOOL::SettingsDialog(), GLOBAL_EDIT_TOOL::swapBoardItem(), GLOBAL_EDIT_TOOL::SwapLayers(), ROUTER_TOOL::switchLayerOnViaPlacement(), DRAWING_TOOL::ToggleHV45Mode(), PCB_CONTROL::ToggleRatsnest(), PCB_CONTROL::unfilledZoneCheck(), updateItem(), ROUTER_TOOL::UpdateMessagePanel(), EDIT_TOOL::updateModificationPoint(), BOARD_EDITOR_CONTROL::UpdateSchematicFromPCB(), PCB_CONTROL::ZoneDisplayMode(), ZONE_FILLER_TOOL::ZoneFill(), ZONE_FILLER_TOOL::ZoneFillAll(), and ZONE_FILLER_TOOL::ZoneFillDirty().

◆ get45DegConstrainer()

EDIT_POINT PCB_POINT_EDITOR::get45DegConstrainer ( ) const
private

Condition to display "Create corner" context menu entry.

Definition at line 2031 of file pcb_point_editor.cpp.

2032{
2033 EDA_ITEM* item = m_editPoints->GetParent();
2034
2035 switch( item->Type() )
2036 {
2037 case PCB_SHAPE_T:
2038 case PCB_FP_SHAPE_T:
2039 switch( static_cast<const PCB_SHAPE*>( item )->GetShape() )
2040 {
2041 case SHAPE_T::SEGMENT:
2042 return *( m_editPoints->Next( *m_editedPoint ) ); // select the other end of line
2043
2044 case SHAPE_T::ARC:
2045 case SHAPE_T::CIRCLE:
2046 return m_editPoints->Point( CIRC_CENTER );
2047
2048 default: // suppress warnings
2049 break;
2050 }
2051
2052 break;
2053
2054 case PCB_DIM_ALIGNED_T:
2056 {
2057 // Constraint for crossbar
2058 if( isModified( m_editPoints->Point( DIM_START ) ) )
2059 return m_editPoints->Point( DIM_END );
2060
2061 else if( isModified( m_editPoints->Point( DIM_END ) ) )
2062 return m_editPoints->Point( DIM_START );
2063
2064 else
2065 return EDIT_POINT( m_editedPoint->GetPosition() ); // no constraint
2066
2067 break;
2068 }
2069
2070 case PCB_DIM_CENTER_T:
2072 {
2073 if( isModified( m_editPoints->Point( DIM_END ) ) )
2074 return m_editPoints->Point( DIM_START );
2075
2076 break;
2077 }
2078
2079 case PCB_DIM_RADIAL_T:
2081 {
2082 if( isModified( m_editPoints->Point( DIM_TEXT ) ) )
2083 return m_editPoints->Point( DIM_KNEE );
2084
2085 break;
2086 }
2087
2088 default:
2089 break;
2090 }
2091
2092 // In any other case we may align item to its original position
2093 return m_original;
2094}
Represent a single point that can be used for modifying items.
Definition: edit_points.h:48
virtual VECTOR2I GetPosition() const
Return coordinates of an EDIT_POINT.
Definition: edit_points.h:71
bool isModified(const EDIT_POINT &aPoint) const
@ DIM_KNEE
@ DIM_TEXT
@ DIM_END
@ DIM_START
@ CIRC_CENTER
@ PCB_FP_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
Definition: typeinfo.h:95
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
Definition: typeinfo.h:108
@ PCB_FP_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
Definition: typeinfo.h:97
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
Definition: typeinfo.h:106
@ PCB_FP_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
Definition: typeinfo.h:98
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
Definition: typeinfo.h:109

References ARC, CIRC_CENTER, CIRCLE, DIM_END, DIM_KNEE, DIM_START, DIM_TEXT, EDIT_POINT::GetPosition(), isModified(), m_editedPoint, m_editPoints, m_original, PCB_DIM_ALIGNED_T, PCB_DIM_CENTER_T, PCB_DIM_RADIAL_T, PCB_FP_DIM_ALIGNED_T, PCB_FP_DIM_CENTER_T, PCB_FP_DIM_RADIAL_T, PCB_FP_SHAPE_T, PCB_SHAPE_T, SEGMENT, and EDA_ITEM::Type().

Referenced by setAltConstraint().

◆ getEditedPointIndex()

int PCB_POINT_EDITOR::getEditedPointIndex ( ) const
inlineprivate

Return true if aPoint is the currently modified point.

Definition at line 95 of file pcb_point_editor.h.

References m_editedPoint, and m_editPoints.

◆ getEditFrame()

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

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

Definition at line 185 of file tool_base.h.

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

References TOOL_BASE::getToolHolderInt().

Referenced by ZONE_CREATE_HELPER::createNewZone(), and ZONE_CREATE_HELPER::setUniquePriority().

◆ GetId()

TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Return 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 }

References TOOL_BASE::m_toolId.

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

◆ GetManager()

TOOL_MANAGER * TOOL_BASE::GetManager ( ) const
inlineinherited

◆ getModel()

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

Return the model object if it matches the requested type.

Store the type of the tool.

Definition at line 197 of file tool_base.h.

References TOOL_BASE::getModelInt().

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

◆ getModelInt()

EDA_ITEM * TOOL_BASE::getModelInt ( ) const
privateinherited

Definition at line 54 of file tool_base.cpp.

55{
56 return m_toolMgr->GetModel();
57}
EDA_ITEM * GetModel() const
Definition: tool_manager.h:292

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

Referenced by TOOL_BASE::getModel().

◆ GetName()

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

Return 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 134 of file tool_base.h.

135 {
136 return m_toolName;
137 }
std::string m_toolName
Definition: tool_base.h:214

References TOOL_BASE::m_toolName.

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

◆ getToolHolderInt()

TOOLS_HOLDER * TOOL_BASE::getToolHolderInt ( ) const
privateinherited

Definition at line 48 of file tool_base.cpp.

49{
50 return m_toolMgr->GetToolHolder();
51}
TOOLS_HOLDER * GetToolHolder() const
Definition: tool_manager.h:296

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

Referenced by TOOL_BASE::getEditFrame().

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Return the type of the tool.

Returns
The type of the tool.

Definition at line 109 of file tool_base.h.

110 {
111 return m_type;
112 }
TOOL_TYPE m_type
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:207

References TOOL_BASE::m_type.

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

◆ getView()

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

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

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

Referenced by EE_POINT_EDITOR::addCornerCondition(), ALIGN_DISTRIBUTE_TOOL::AlignLeft(), ALIGN_DISTRIBUTE_TOOL::AlignRight(), COMMON_TOOLS::CenterContents(), SCH_EDIT_TOOL::ChangeTextType(), EE_INSPECTION_TOOL::CheckSymbol(), GERBVIEW_CONTROL::ClearAllLayers(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::CollectHits(), SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint(), COMMON_TOOLS::CursorControl(), SCH_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), EDIT_TOOL::DeleteItems(), PL_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SELECTION_TOOL::doSelectionMenu(), COMMON_TOOLS::doZoomFit(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), EE_SELECTION_TOOL::GetNode(), ROUTER_TOOL::getStartLayer(), PCB_CONTROL::GridResetOrigin(), PCB_CONTROL::GridSetOrigin(), EE_SELECTION_TOOL::GuessSelectionCandidates(), PCB_SELECTION_TOOL::GuessSelectionCandidates(), ROUTER_TOOL::handleCommonEvents(), EE_SELECTION_TOOL::highlight(), PL_SELECTION_TOOL::highlight(), PCB_SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::highlightNet(), PNS::TOOL_BASE::highlightNets(), PCB_SELECTION_TOOL::hitTestDistance(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineDrag(), EE_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), PCB_PICKER_TOOL::Main(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), PL_EDIT_TOOL::moveItem(), COMMON_TOOLS::OnGridChanged(), OnSelectionChange(), COMMON_TOOLS::PanControl(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), ROUTER_TOOL::performRouting(), PNS::TOOL_BASE::pickSingleItem(), BOARD_EDITOR_CONTROL::PlaceFootprint(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EE_SELECTION_TOOL::Reset(), EE_TOOL_BASE< T >::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), PNS::TOOL_BASE::Reset(), BOARD_EDITOR_CONTROL::Reset(), DRAWING_TOOL::Reset(), PCB_CONTROL::Reset(), PCB_SELECTION_TOOL::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), PCB_SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::SelectAll(), PCB_SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::selectionContains(), PL_SELECTION_TOOL::selectionContains(), PCB_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), EE_SELECTION_TOOL::selectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_EDITOR_CONTROL::ToggleERCErrors(), SCH_EDITOR_CONTROL::ToggleERCExclusions(), SCH_EDITOR_CONTROL::ToggleERCWarnings(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), SCH_EDITOR_CONTROL::ToggleOPCurrents(), SCH_EDITOR_CONTROL::ToggleOPVoltages(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), EE_SELECTION_TOOL::unhighlight(), PL_SELECTION_TOOL::unhighlight(), PCB_SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), updateEditedPoint(), SCH_FIND_REPLACE_TOOL::UpdateFind(), PL_POINT_EDITOR::updateItem(), updateItem(), EE_TOOL_BASE< T >::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), updatePoints(), PCB_SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), PCB_SELECTION_TOOL::view(), PCB_TOOL_BASE::view(), PCB_VIEWER_TOOLS::view(), EE_SELECTION_TOOL::ZoomFitCrossProbeBBox(), PCB_SELECTION_TOOL::ZoomFitCrossProbeBBox(), PCB_SELECTION_TOOL::zoomFitSelection(), EE_SELECTION_TOOL::~EE_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and PCB_SELECTION_TOOL::~PCB_SELECTION_TOOL().

◆ getViewControls()

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

Return 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}
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:287

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

Referenced by EE_POINT_EDITOR::addCorner(), addCorner(), EE_POINT_EDITOR::addCornerCondition(), EE_SELECTION_TOOL::autostartEvent(), SCH_EDIT_TOOL::BreakWire(), PCB_SELECTION_TOOL::controls(), PCB_TOOL_BASE::controls(), EDIT_TOOL::copyToClipboard(), COMMON_TOOLS::CursorControl(), EDIT_TOOL::DeleteItems(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), SCH_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::HighlightNet(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), EE_POINT_EDITOR::Main(), EE_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_POINT_EDITOR::Main(), PCB_PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), COMMON_TOOLS::OnGridChanged(), OnSelectionChange(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), ROUTER_TOOL::performDragging(), LENGTH_TUNER_TOOL::performTuning(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), SCH_EDIT_TOOL::RepeatDrawItem(), PL_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), DRAWING_TOOL::Reset(), Reset(), COMMON_TOOLS::ResetLocalCoords(), ROUTER_TOOL::RouteSelected(), PCB_SELECTION_TOOL::selectCursor(), EE_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PICKER_TOOL::setControls(), PCB_PICKER_TOOL::setControls(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), updateEditedPoint(), updateItem(), PL_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

Define which state (aStateFunc) to go when a certain event arrives (aConditions).

No conditions means any event.

Definition at line 147 of file tool_interactive.h.

149{
150 TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
151
152 goInternal( sptr, aConditions );
153}
void goInternal(TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:58

References TOOL_INTERACTIVE::goInternal().

Referenced by EDA_3D_CONTROLLER::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), EE_POINT_EDITOR::setTransitions(), EE_SELECTION_TOOL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), SCH_EDIT_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), SCH_FIND_REPLACE_TOOL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), SCH_MOVE_TOOL::setTransitions(), SCH_NAVIGATE_TOOL::setTransitions(), SIMULATOR_CONTROL::setTransitions(), SYMBOL_EDITOR_CONTROL::setTransitions(), SYMBOL_EDITOR_DRAWING_TOOLS::setTransitions(), SYMBOL_EDITOR_EDIT_TOOL::setTransitions(), SYMBOL_EDITOR_MOVE_TOOL::setTransitions(), SYMBOL_EDITOR_PIN_TOOL::setTransitions(), GERBVIEW_CONTROL::setTransitions(), GERBVIEW_INSPECTION_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), COMMON_CONTROL::setTransitions(), COMMON_TOOLS::setTransitions(), PICKER_TOOL::setTransitions(), ZOOM_TOOL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), PL_EDIT_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), PL_POINT_EDITOR::setTransitions(), PL_SELECTION_TOOL::setTransitions(), AUTOPLACE_TOOL::setTransitions(), MICROWAVE_TOOL::setTransitions(), SCRIPTING_TOOL::setTransitions(), LENGTH_TUNER_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), BOARD_EDITOR_CONTROL::setTransitions(), BOARD_INSPECTION_TOOL::setTransitions(), BOARD_REANNOTATE_TOOL::setTransitions(), CONVERT_TOOL::setTransitions(), DRAWING_TOOL::setTransitions(), DRC_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), FOOTPRINT_EDITOR_CONTROL::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), GROUP_TOOL::setTransitions(), PAD_TOOL::setTransitions(), PCB_CONTROL::setTransitions(), PCB_PICKER_TOOL::setTransitions(), setTransitions(), PCB_SELECTION_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), PROPERTIES_TOOL::setTransitions(), and ZONE_FILLER_TOOL::setTransitions().

◆ goInternal()

void TOOL_INTERACTIVE::goInternal ( TOOL_STATE_FUNC aState,
const TOOL_EVENT_LIST aConditions 
)
privateinherited

Definition at line 70 of file tool_interactive.cpp.

71{
72 m_toolMgr->ScheduleNextState( this, aState, aConditions );
73}
void ScheduleNextState(TOOL_BASE *aTool, TOOL_STATE_FUNC &aHandler, const TOOL_EVENT_LIST &aConditions)
Define a state transition.

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

Referenced by TOOL_INTERACTIVE::Go().

◆ HasPoint()

bool PCB_POINT_EDITOR::HasPoint ( )
inline

Indicate the cursor is over an edit point.

Used to coordinate cursor shapes with other tools.

Definition at line 65 of file pcb_point_editor.h.

65{ return m_editedPoint != nullptr; }

References m_editedPoint.

Referenced by PCB_SELECTION_TOOL::Main().

◆ Init()

bool PCB_POINT_EDITOR::Init ( )
overridevirtual

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 128 of file pcb_point_editor.cpp.

129{
130 // Find the selection tool, so they can cooperate
132
133 wxASSERT_MSG( m_selectionTool, wxT( "pcbnew.InteractiveSelection tool is not available" ) );
134
135 auto& menu = m_selectionTool->GetToolMenu().GetMenu();
138 std::bind( &PCB_POINT_EDITOR::removeCornerCondition, this, _1 ) );
139
140 return true;
141}
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Add a menu entry to run a TOOL_ACTION on selected items.
static TOOL_ACTION pointEditorRemoveCorner
Definition: pcb_actions.h:246
static TOOL_ACTION pointEditorAddCorner
Definition: pcb_actions.h:245
bool removeCornerCondition(const SELECTION &aSelection)
static bool addCornerCondition(const SELECTION &aSelection)
Determine if the tool can currently add a corner to the given item.
The selection tool: currently supports:
TOOL_MENU & GetToolMenu()
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:44

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().

◆ Is45Limited()

bool PCB_TOOL_BASE::Is45Limited ( ) const
virtualinherited

Should the tool use its 45° mode option?

Returns
True if set to use 45°

Definition at line 332 of file pcb_tool_base.cpp.

333{
334 SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
335
336 if( frame()->IsType( FRAME_PCB_EDITOR ) )
337 return mgr.GetAppSettings<PCBNEW_SETTINGS>()->m_Use45DegreeLimit;
338 else
339 return mgr.GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>()->m_Use45Limit;
340}
T * GetAppSettings(bool aLoadNow=true)
Returns a handle to the a given settings by type If the settings have already been loaded,...
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111

References PCB_TOOL_BASE::frame(), FRAME_PCB_EDITOR, SETTINGS_MANAGER::GetAppSettings(), and Pgm().

Referenced by DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawShape(), DRAWING_TOOL::DrawZone(), and ZONE_CREATE_HELPER::OnFirstPoint().

◆ IsBoardEditor()

bool PCB_TOOL_BASE::IsBoardEditor ( ) const
inlineinherited

Definition at line 109 of file pcb_tool_base.h.

109{ return m_isBoardEditor; }

References PCB_TOOL_BASE::m_isBoardEditor.

Referenced by BOARD_COMMIT::BOARD_COMMIT().

◆ IsFootprintEditor()

◆ isModified()

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

Definition at line 107 of file pcb_point_editor.h.

108 {
109 return m_editedPoint == &aPoint;
110 }

References m_editedPoint.

Referenced by get45DegConstrainer(), pinEditedCorner(), and updateItem().

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 31 of file tool_base.cpp.

32{
34}
bool IsToolActive(TOOL_ID aId) const
Return true if a tool with given id is active (executing)

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

Referenced by EDIT_TOOL::Drag(), ROUTER_TOOL::handleLayerSwitch(), PCB_SELECTION_TOOL::Main(), BOARD_EDITOR_CONTROL::TrackWidthDec(), and BOARD_EDITOR_CONTROL::TrackWidthInc().

◆ makePoints()

std::shared_ptr< EDIT_POINTS > PCB_POINT_EDITOR::makePoints ( EDA_ITEM aItem)
private

Update item's points with edit points.

Definition at line 177 of file pcb_point_editor.cpp.

178{
179 std::shared_ptr<EDIT_POINTS> points = std::make_shared<EDIT_POINTS>( aItem );
180
181 if( !aItem )
182 return points;
183
184 if( aItem->Type() == PCB_TEXTBOX_T || aItem->Type() == PCB_FP_TEXTBOX_T )
185 {
186 const PCB_SHAPE* shape = static_cast<const PCB_SHAPE*>( aItem );
187
188 // We can't currently handle TEXTBOXes that have been turned into SHAPE_T::POLYs due
189 // to non-cardinal rotations
190 if( shape->GetShape() != SHAPE_T::RECT )
191 return points;
192 }
193
194 // Generate list of edit points basing on the item type
195 switch( aItem->Type() )
196 {
197 case PCB_BITMAP_T:
198 {
199 PCB_BITMAP* bitmap = (PCB_BITMAP*) aItem;
200 VECTOR2I topLeft = bitmap->GetPosition() - bitmap->GetSize() / 2;
201 VECTOR2I botRight = bitmap->GetPosition() + bitmap->GetSize() / 2;
202
203 points->AddPoint( topLeft );
204 points->AddPoint( VECTOR2I( botRight.x, topLeft.y ) );
205 points->AddPoint( botRight );
206 points->AddPoint( VECTOR2I( topLeft.x, botRight.y ) );
207
208 break;
209 }
210
211 case PCB_TEXTBOX_T:
212 case PCB_FP_TEXTBOX_T:
213 case PCB_SHAPE_T:
214 case PCB_FP_SHAPE_T:
215 {
216 const PCB_SHAPE* shape = static_cast<const PCB_SHAPE*>( aItem );
217
218 switch( shape->GetShape() )
219 {
220 case SHAPE_T::SEGMENT:
221 points->AddPoint( shape->GetStart() );
222 points->AddPoint( shape->GetEnd() );
223 break;
224
225 case SHAPE_T::RECT:
226 points->AddPoint( shape->GetTopLeft() );
227 points->AddPoint( VECTOR2I( shape->GetBotRight().x, shape->GetTopLeft().y ) );
228 points->AddPoint( shape->GetBotRight() );
229 points->AddPoint( VECTOR2I( shape->GetTopLeft().x, shape->GetBotRight().y ) );
230
231 points->AddLine( points->Point( RECT_TOP_LEFT ), points->Point( RECT_TOP_RIGHT ) );
232 points->Line( RECT_TOP ).SetConstraint( new EC_PERPLINE( points->Line( RECT_TOP ) ) );
233 points->AddLine( points->Point( RECT_TOP_RIGHT ), points->Point( RECT_BOT_RIGHT ) );
234 points->Line( RECT_RIGHT ).SetConstraint( new EC_PERPLINE( points->Line( RECT_RIGHT ) ) );
235 points->AddLine( points->Point( RECT_BOT_RIGHT ), points->Point( RECT_BOT_LEFT ) );
236 points->Line( RECT_BOT ).SetConstraint( new EC_PERPLINE( points->Line( RECT_BOT ) ) );
237 points->AddLine( points->Point( RECT_BOT_LEFT ), points->Point( RECT_TOP_LEFT ) );
238 points->Line( RECT_LEFT ).SetConstraint( new EC_PERPLINE( points->Line( RECT_LEFT ) ) );
239
240 break;
241
242 case SHAPE_T::ARC:
243 points->AddPoint( shape->GetCenter() );
244 points->AddPoint( shape->GetStart() );
245 points->AddPoint( shape->GetArcMid() );
246 points->AddPoint( shape->GetEnd() );
247 break;
248
249 case SHAPE_T::CIRCLE:
250 points->AddPoint( shape->GetCenter() );
251 points->AddPoint( shape->GetEnd() );
252 break;
253
254 case SHAPE_T::POLY:
255 buildForPolyOutline( points, &shape->GetPolyShape() );
256 break;
257
258 case SHAPE_T::BEZIER:
259 points->AddPoint( shape->GetStart() );
260 points->AddPoint( shape->GetBezierC1() );
261 points->AddPoint( shape->GetBezierC2() );
262 points->AddPoint( shape->GetEnd() );
263 break;
264
265 default: // suppress warnings
266 break;
267 }
268
269 break;
270 }
271
272 case PCB_PAD_T:
273 {
274 const PAD* pad = static_cast<const PAD*>( aItem );
275 VECTOR2I shapePos = pad->ShapePos();
276 VECTOR2I halfSize( pad->GetSize().x / 2, pad->GetSize().y / 2 );
277
278 if( !m_isFootprintEditor || pad->IsLocked() )
279 break;
280
281 switch( pad->GetShape() )
282 {
284 points->AddPoint( VECTOR2I( shapePos.x + halfSize.x, shapePos.y ) );
285 break;
286
287 case PAD_SHAPE::OVAL:
289 case PAD_SHAPE::RECT:
292 {
293 if( !pad->GetOrientation().IsCardinal() )
294 break;
295
296 if( pad->GetOrientation() == ANGLE_90 || pad->GetOrientation() == ANGLE_270 )
297 std::swap( halfSize.x, halfSize.y );
298
299 points->AddPoint( shapePos - halfSize );
300 points->AddPoint( VECTOR2I( shapePos.x + halfSize.x, shapePos.y - halfSize.y ) );
301 points->AddPoint( shapePos + halfSize );
302 points->AddPoint( VECTOR2I( shapePos.x - halfSize.x, shapePos.y + halfSize.y ) );
303 }
304 break;
305
306 default: // suppress warnings
307 break;
308 }
309 }
310 break;
311
312 case PCB_FP_ZONE_T:
313 case PCB_ZONE_T:
314 {
315 const ZONE* zone = static_cast<const ZONE*>( aItem );
316 buildForPolyOutline( points, zone->Outline() );
317 }
318 break;
319
324 {
325 const PCB_DIM_ALIGNED* dimension = static_cast<const PCB_DIM_ALIGNED*>( aItem );
326
327 points->AddPoint( dimension->GetStart() );
328 points->AddPoint( dimension->GetEnd() );
329 points->AddPoint( dimension->GetTextPos() );
330 points->AddPoint( dimension->GetCrossbarStart() );
331 points->AddPoint( dimension->GetCrossbarEnd() );
332
333 points->Point( DIM_START ).SetSnapConstraint( ALL_LAYERS );
334 points->Point( DIM_END ).SetSnapConstraint( ALL_LAYERS );
335
336 if( aItem->Type() == PCB_DIM_ALIGNED_T )
337 {
338 // Dimension height setting - edit points should move only along the feature lines
339 points->Point( DIM_CROSSBARSTART )
340 .SetConstraint( new EC_LINE( points->Point( DIM_CROSSBARSTART ),
341 points->Point( DIM_START ) ) );
342 points->Point( DIM_CROSSBAREND )
343 .SetConstraint( new EC_LINE( points->Point( DIM_CROSSBAREND ),
344 points->Point( DIM_END ) ) );
345 }
346
347 break;
348 }
349
350 case PCB_DIM_CENTER_T:
352 {
353 const PCB_DIM_CENTER* dimension = static_cast<const PCB_DIM_CENTER*>( aItem );
354
355 points->AddPoint( dimension->GetStart() );
356 points->AddPoint( dimension->GetEnd() );
357
358 points->Point( DIM_START ).SetSnapConstraint( ALL_LAYERS );
359
360 points->Point( DIM_END ).SetConstraint( new EC_45DEGREE( points->Point( DIM_END ),
361 points->Point( DIM_START ) ) );
362 points->Point( DIM_END ).SetSnapConstraint( IGNORE_SNAPS );
363
364 break;
365 }
366
367 case PCB_DIM_RADIAL_T:
369 {
370 const PCB_DIM_RADIAL* dimension = static_cast<const PCB_DIM_RADIAL*>( aItem );
371
372 points->AddPoint( dimension->GetStart() );
373 points->AddPoint( dimension->GetEnd() );
374 points->AddPoint( dimension->GetTextPos() );
375 points->AddPoint( dimension->GetKnee() );
376
377 points->Point( DIM_START ).SetSnapConstraint( ALL_LAYERS );
378 points->Point( DIM_END ).SetSnapConstraint( ALL_LAYERS );
379
380 points->Point( DIM_KNEE ).SetConstraint( new EC_LINE( points->Point( DIM_START ),
381 points->Point( DIM_END ) ) );
382 points->Point( DIM_KNEE ).SetSnapConstraint( IGNORE_SNAPS );
383
384 points->Point( DIM_TEXT ).SetConstraint( new EC_45DEGREE( points->Point( DIM_TEXT ),
385 points->Point( DIM_KNEE ) ) );
386 points->Point( DIM_TEXT ).SetSnapConstraint( IGNORE_SNAPS );
387
388 break;
389 }
390
391 case PCB_DIM_LEADER_T:
393 {
394 const PCB_DIM_LEADER* dimension = static_cast<const PCB_DIM_LEADER*>( aItem );
395
396 points->AddPoint( dimension->GetStart() );
397 points->AddPoint( dimension->GetEnd() );
398 points->AddPoint( dimension->GetTextPos() );
399
400 points->Point( DIM_START ).SetSnapConstraint( ALL_LAYERS );
401 points->Point( DIM_END ).SetSnapConstraint( ALL_LAYERS );
402
403 points->Point( DIM_TEXT ).SetConstraint( new EC_45DEGREE( points->Point( DIM_TEXT ),
404 points->Point( DIM_END ) ) );
405 points->Point( DIM_TEXT ).SetSnapConstraint( IGNORE_SNAPS );
406
407 break;
408 }
409
410 default:
411 points.reset();
412 break;
413 }
414
415 return points;
416}
EDIT_CONSTRAINT that imposes a constraint that two points have to be located at angle of 45 degree mu...
EDIT_CONSTRAINT that imposes a constraint that a point has to lie on a line (determined by 2 points).
const VECTOR2I & GetBezierC2() const
Definition: eda_shape.h:179
virtual VECTOR2I GetTopLeft() const
Definition: eda_shape.h:167
virtual VECTOR2I GetBotRight() const
Definition: eda_shape.h:168
const VECTOR2I & GetBezierC1() const
Definition: eda_shape.h:176
const VECTOR2I & GetTextPos() const
Definition: eda_text.h:208
Definition: pad.h:60
Object to handle a bitmap image that can be inserted in a PCB.
Definition: pcb_bitmap.h:42
VECTOR2I GetPosition() const override
Definition: pcb_bitmap.h:127
const VECTOR2I GetSize() const
Definition: pcb_bitmap.cpp:160
virtual const VECTOR2I & GetStart() const
The dimension's origin is the first feature point for the dimension.
virtual const VECTOR2I & GetEnd() const
For better understanding of the points that make a dimension:
const VECTOR2I & GetCrossbarStart() const
const VECTOR2I & GetCrossbarEnd() const
Mark the center of a circle or arc with a cross shape.
A leader is a dimension-like object pointing to a specific point.
A radial dimension indicates either the radius or diameter of an arc or circle.
VECTOR2I GetKnee() const
void buildForPolyOutline(std::shared_ptr< EDIT_POINTS > points, const SHAPE_POLY_SET *aOutline)
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: pcb_shape.h:67
static constexpr EDA_ANGLE & ANGLE_90
Definition: eda_angle.h:431
static constexpr EDA_ANGLE & ANGLE_270
Definition: eda_angle.h:434
@ ALL_LAYERS
@ IGNORE_SNAPS
@ RECT_RIGHT
@ RECT_LEFT
@ RECT_BOT
@ RECT_TOP
@ RECT_BOT_LEFT
@ RECT_BOT_RIGHT
@ RECT_TOP_RIGHT
@ RECT_TOP_LEFT
@ DIM_CROSSBAREND
@ DIM_CROSSBARSTART
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
Definition: typeinfo.h:110
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:107
@ PCB_FP_TEXTBOX_T
class FP_TEXTBOX, wrapped text in a footprint
Definition: typeinfo.h:93
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
Definition: typeinfo.h:91
@ PCB_FP_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
Definition: typeinfo.h:99
@ PCB_FP_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:96
@ PCB_BITMAP_T
class PCB_BITMAP, bitmap on a layer
Definition: typeinfo.h:89
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition: typeinfo.h:87

References ALL_LAYERS, ANGLE_270, ANGLE_90, ARC, BEZIER, buildForPolyOutline(), CHAMFERED_RECT, CIRCLE, DIM_CROSSBAREND, DIM_CROSSBARSTART, DIM_END, DIM_KNEE, DIM_START, DIM_TEXT, EDA_SHAPE::GetArcMid(), EDA_SHAPE::GetBezierC1(), EDA_SHAPE::GetBezierC2(), EDA_SHAPE::GetBotRight(), PCB_SHAPE::GetCenter(), PCB_DIM_ALIGNED::GetCrossbarEnd(), PCB_DIM_ALIGNED::GetCrossbarStart(), EDA_SHAPE::GetEnd(), PCB_DIMENSION_BASE::GetEnd(), PCB_DIM_RADIAL::GetKnee(), EDA_SHAPE::GetPolyShape(), PCB_BITMAP::GetPosition(), EDA_SHAPE::GetShape(), PCB_BITMAP::GetSize(), EDA_SHAPE::GetStart(), PCB_DIMENSION_BASE::GetStart(), EDA_TEXT::GetTextPos(), EDA_SHAPE::GetTopLeft(), IGNORE_SNAPS, PCB_TOOL_BASE::m_isFootprintEditor, ZONE::Outline(), OVAL, pad, PCB_BITMAP_T, PCB_DIM_ALIGNED_T, PCB_DIM_CENTER_T, PCB_DIM_LEADER_T, PCB_DIM_ORTHOGONAL_T, PCB_DIM_RADIAL_T, PCB_FP_DIM_ALIGNED_T, PCB_FP_DIM_CENTER_T, PCB_FP_DIM_LEADER_T, PCB_FP_DIM_ORTHOGONAL_T, PCB_FP_DIM_RADIAL_T, PCB_FP_SHAPE_T, PCB_FP_TEXTBOX_T, PCB_FP_ZONE_T, PCB_PAD_T, PCB_SHAPE_T, PCB_TEXTBOX_T, PCB_ZONE_T, POLY, RECT, RECT_BOT, RECT_BOT_LEFT, RECT_BOT_RIGHT, RECT_LEFT, RECT_RIGHT, RECT_TOP, RECT_TOP_LEFT, RECT_TOP_RIGHT, ROUNDRECT, SEGMENT, TRAPEZOID, EDA_ITEM::Type(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by OnSelectionChange(), and updatePoints().

◆ modifiedSelection()

int PCB_POINT_EDITOR::modifiedSelection ( const TOOL_EVENT aEvent)
private

Definition at line 2406 of file pcb_point_editor.cpp.

2407{
2408 updatePoints();
2409 return 0;
2410}

References updatePoints().

Referenced by setTransitions().

◆ OnSelectionChange()

int PCB_POINT_EDITOR::OnSelectionChange ( const TOOL_EVENT aEvent)

Change selection event handler.

Definition at line 460 of file pcb_point_editor.cpp.

461{
463 return 0;
464
465 PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
467
468 if( selection.Size() != 1 || selection.Front()->GetEditFlags() )
469 return 0;
470
471 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( selection.Front() );
472
473 if( !item || item->IsLocked() )
474 return 0;
475
476 Activate();
477 // Must be done after Activate() so that it gets set into the correct context
478 getViewControls()->ShowCursor( true );
479
481 m_editPoints = makePoints( item );
482
483 if( !m_editPoints )
484 return 0;
485
486 getView()->Add( m_editPoints.get() );
487 setEditedPoint( nullptr );
488 updateEditedPoint( aEvent );
489 m_refill = false;
490 bool inDrag = false;
491 bool useAltContraint = false;
492
493 BOARD_COMMIT commit( editFrame );
494
495 // Main loop: keep receiving events
496 while( TOOL_EVENT* evt = Wait() )
497 {
498 grid.SetSnap( !evt->Modifier( MD_SHIFT ) );
499 grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
500
501 if( editFrame->IsType( FRAME_PCB_EDITOR ) )
502 {
503 useAltContraint = editFrame->GetPcbNewSettings()->m_Use45DegreeLimit;
505 }
506 else
507 {
508 useAltContraint = editFrame->GetFootprintEditorSettings()->m_Use45Limit;
510 }
511
512 if( !m_editPoints || evt->IsSelectionEvent() ||
513 evt->Matches( EVENTS::InhibitSelectionEditing ) )
514 {
515 break;
516 }
517
518 EDIT_POINT* prevHover = m_hoveredPoint;
519
520 if( !inDrag )
521 updateEditedPoint( *evt );
522
523 if( prevHover != m_hoveredPoint )
524 getView()->Update( m_editPoints.get() );
525
526 if( evt->IsDrag( BUT_LEFT ) && m_editedPoint )
527 {
528 if( !inDrag )
529 {
530 frame()->UndoRedoBlock( true );
531
532 commit.StageItems( selection, CHT_MODIFY );
533
535 m_original = *m_editedPoint; // Save the original position
536 getViewControls()->SetAutoPan( true );
537 inDrag = true;
538
540 grid.SetAuxAxes( true, m_original.GetPosition() );
541
542 setAltConstraint( true );
544
545 for( size_t ii = 0; ii < m_editPoints->PointsSize(); ++ii )
546 {
547 EDIT_POINT& point = m_editPoints->Point( ii );
548
549 if( &point != m_editedPoint )
550 point.SetActive( false );
551 }
552 }
553
554 // Keep point inside of limits with some padding
555 VECTOR2I pos = GetClampedCoords<double, int>( evt->Position(), COORDS_PADDING );
556 LSET snapLayers;
557
559 {
560 case IGNORE_SNAPS: break;
561 case OBJECT_LAYERS: snapLayers = item->GetLayerSet(); break;
562 case ALL_LAYERS: snapLayers = LSET::AllLayersMask(); break;
563 }
564
566 {
567 if( grid.GetUseGrid() )
568 {
569 VECTOR2I gridPt = grid.BestSnapAnchor( pos, {}, { item } );
570
572 VECTOR2I delta = pos - last;
573 VECTOR2I deltaGrid = gridPt - grid.BestSnapAnchor( last, {}, { item } );
574
575 if( abs( delta.x ) > grid.GetGrid().x / 2 )
576 pos.x = last.x + deltaGrid.x;
577 else
578 pos.x = last.x;
579
580 if( abs( delta.y ) > grid.GetGrid().y / 2 )
581 pos.y = last.y + deltaGrid.y;
582 else
583 pos.y = last.y;
584 }
585 }
586
588
589 // The alternative constraint limits to 45 degrees
590 if( useAltContraint )
591 {
592 m_altConstraint->Apply( grid );
593 }
594 else if( m_editedPoint->IsConstrained() )
595 {
597 }
599 {
601 snapLayers, { item } ) );
602 }
603
604 updateItem();
606 updatePoints();
607 }
608 else if( m_editedPoint && evt->Action() == TA_MOUSE_DOWN && evt->Buttons() == BUT_LEFT )
609 {
611
612 for( size_t ii = 0; ii < m_editPoints->PointsSize(); ++ii )
613 {
614 EDIT_POINT& point = m_editPoints->Point( ii );
615
616 if( &point != m_editedPoint )
617 point.SetActive( false );
618 }
619
620 getView()->Update( m_editPoints.get() );
621 }
622 else if( inDrag && evt->IsMouseUp( BUT_LEFT ) )
623 {
624 if( m_editedPoint )
625 {
626 m_editedPoint->SetActive( false );
627 getView()->Update( m_editPoints.get() );
628 }
629
630 getViewControls()->SetAutoPan( false );
631 setAltConstraint( false );
632
633 commit.Push( _( "Drag a corner" ) );
634 inDrag = false;
635 frame()->UndoRedoBlock( false );
636
637 m_refill = true;
638 }
639 else if( evt->IsCancelInteractive() || evt->IsActivate() )
640 {
641 if( inDrag ) // Restore the last change
642 {
643 commit.Revert();
644 inDrag = false;
645 frame()->UndoRedoBlock( false );
646 }
647
648 // Only cancel point editor when activating a new tool
649 // Otherwise, allow the points to persist when moving up the
650 // tool stack
651 if( evt->IsActivate() && !evt->IsMoveTool() )
652 break;
653 }
654 else if( evt->Action() == TA_UNDO_REDO_POST )
655 {
656 break;
657 }
658 else
659 {
660 evt->SetPassEvent();
661 }
662 }
663
664 if( m_editPoints )
665 {
666 getView()->Remove( m_editPoints.get() );
667 m_editPoints.reset();
668 }
669
670 m_editedPoint = nullptr;
671
672 return 0;
673}
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition: board_item.h:197
virtual bool IsLocked() const
Definition: board_item.cpp:71
EDA_ITEM_FLAGS GetEditFlags() const
Definition: eda_item.h:145
SNAP_CONSTRAINT_TYPE GetSnapConstraint() const
Definition: edit_points.h:181
virtual void SetPosition(const VECTOR2I &aPosition)
Set new coordinates for an EDIT_POINT.
Definition: edit_points.h:107
virtual void ApplyConstraint(const GRID_HELPER &aGrid)
Correct coordinates of an EDIT_POINT by applying previously set constraint.
Definition: edit_points.h:166
bool IsConstrained() const
Check if point is constrained.
Definition: edit_points.h:158
void SetActive(bool aActive=true)
Definition: edit_points.h:173
GRID_CONSTRAINT_TYPE GetGridConstraint() const
Definition: edit_points.h:178
static const TOOL_EVENT InhibitSelectionEditing
Definition: actions.h:220
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:316
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:349
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1591
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:532
static LSET AllLayersMask()
Definition: lset.cpp:808
void UndoRedoBlock(bool aBlock=true)
Enable/disable undo and redo operations.
virtual MAGNETIC_SETTINGS * GetMagneticItemsSettings()
void setAltConstraint(bool aEnabled)
Return a point that should be used as a constrainer for 45 degrees mode.
static const unsigned int COORDS_PADDING
void setEditedPoint(EDIT_POINT *aPoint)
void updateEditedPoint(const TOOL_EVENT &aEvent)
Set the current point being edited. NULL means none.
std::shared_ptr< EDIT_CONSTRAINT< EDIT_POINT > > m_altConstraint
std::shared_ptr< EDIT_POINTS > makePoints(EDA_ITEM *aItem)
Update item's points with edit points.
PCB_SELECTION & GetSelection()
@ CHT_MODIFY
Definition: commit.h:42
@ OBJECT_LAYERS
@ SNAP_BY_GRID
@ SNAP_TO_GRID
@ TA_MOUSE_DOWN
Definition: tool_event.h:65
@ TA_UNDO_REDO_POST
Definition: tool_event.h:104
@ MD_SHIFT
Definition: tool_event.h:138

References _, std::abs(), TOOL_INTERACTIVE::Activate(), KIGFX::VIEW::Add(), ALL_LAYERS, LSET::AllLayersMask(), EDIT_POINT::ApplyConstraint(), BUT_LEFT, CHT_MODIFY, COORDS_PADDING, delta, KIGFX::VIEW_CONTROLS::ForceCursorPosition(), PCB_TOOL_BASE::frame(), FRAME_PCB_EDITOR, SELECTION::Front(), EDA_ITEM::GetEditFlags(), PCB_BASE_FRAME::GetFootprintEditorSettings(), EDIT_POINT::GetGridConstraint(), BOARD_ITEM::GetLayerSet(), PCB_BASE_FRAME::GetMagneticItemsSettings(), PCB_BASE_FRAME::GetPcbNewSettings(), EDIT_POINT::GetPosition(), PCB_SELECTION_TOOL::GetSelection(), EDIT_POINT::GetSnapConstraint(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), grid, IGNORE_SNAPS, EVENTS::InhibitSelectionEditing, EDIT_POINT::IsConstrained(), BOARD_ITEM::IsLocked(), EDA_BASE_FRAME::IsType(), m_altConstraint, FOOTPRINT_EDITOR_SETTINGS::m_ArcEditMode, PCBNEW_SETTINGS::m_ArcEditMode, m_arcEditMode, m_editedPoint, m_editPoints, m_hoveredPoint, m_original, m_refill, m_selectionTool, TOOL_BASE::m_toolMgr, PCBNEW_SETTINGS::m_Use45DegreeLimit, FOOTPRINT_EDITOR_SETTINGS::m_Use45Limit, makePoints(), TOOL_EVENT::Matches(), MD_SHIFT, OBJECT_LAYERS, BOARD_COMMIT::Push(), KIGFX::VIEW::Remove(), BOARD_COMMIT::Revert(), PCB_TOOL_BASE::selection(), EDIT_POINT::SetActive(), setAltConstraint(), KIGFX::VIEW_CONTROLS::SetAutoPan(), setEditedPoint(), EDIT_POINT::SetPosition(), KIGFX::VIEW_CONTROLS::ShowCursor(), SELECTION::Size(), SNAP_BY_GRID, SNAP_TO_GRID, COMMIT::StageItems(), TA_MOUSE_DOWN, TA_UNDO_REDO_POST, PCB_BASE_EDIT_FRAME::UndoRedoBlock(), KIGFX::VIEW::Update(), updateEditedPoint(), updateItem(), updatePoints(), TOOL_INTERACTIVE::Wait(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by setTransitions().

◆ pinEditedCorner()

void PCB_POINT_EDITOR::pinEditedCorner ( VECTOR2I aTopLeft,
VECTOR2I aTopRight,
VECTOR2I aBotLeft,
VECTOR2I aBotRight,
const VECTOR2I aHole = { 0, 0 },
const VECTOR2I aHoleSize = { 0, 0 } 
) const
private

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

Update the coordinates of 4 corners of a rectangle, according to pad constraints and the moved corner.

Parameters
aTopLeft[in/out] is the RECT_TOPLEFT to constraint
aTopRight[in/out] is the RECT_TOPRIGHT to constraint
aBotLeft[in/out] is the RECT_BOTLEFT to constraint
aBotRight[in/out] is the RECT_BOTRIGHT to constraint
aHolethe location of the pad's hole
aHoleSizethe pad's hole size (or {0,0} if it has no hole)

Definition at line 878 of file pcb_point_editor.cpp.

881{
882 int minWidth = EDA_UNIT_UTILS::Mils2IU( pcbIUScale, 1 );
883 int minHeight = EDA_UNIT_UTILS::Mils2IU( pcbIUScale, 1 );
884
885 if( isModified( m_editPoints->Point( RECT_TOP_LEFT ) ) )
886 {
887 if( aHoleSize.x )
888 {
889 // pin edited point to the top/left of the hole
890 aTopLeft.x = std::min( aTopLeft.x, aHole.x - aHoleSize.x / 2 - minWidth );
891 aTopLeft.y = std::min( aTopLeft.y, aHole.y - aHoleSize.y / 2 - minHeight );
892 }
893 else
894 {
895 // pin edited point within opposite corner
896 aTopLeft.x = std::min( aTopLeft.x, aBotRight.x - minWidth );
897 aTopLeft.y = std::min( aTopLeft.y, aBotRight.y - minHeight );
898 }
899
900 // push edited point edges to adjacent corners
901 aTopRight.y = aTopLeft.y;
902 aBotLeft.x = aTopLeft.x;
903 }
904 else if( isModified( m_editPoints->Point( RECT_TOP_RIGHT ) ) )
905 {
906 if( aHoleSize.x )
907 {
908 // pin edited point to the top/right of the hole
909 aTopRight.x = std::max( aTopRight.x, aHole.x + aHoleSize.x / 2 + minWidth );
910 aTopRight.y = std::min( aTopRight.y, aHole.y - aHoleSize.y / 2 - minHeight );
911 }
912 else
913 {
914 // pin edited point within opposite corner
915 aTopRight.x = std::max( aTopRight.x, aBotLeft.x + minWidth );
916 aTopRight.y = std::min( aTopRight.y, aBotLeft.y - minHeight );
917 }
918
919 // push edited point edges to adjacent corners
920 aTopLeft.y = aTopRight.y;
921 aBotRight.x = aTopRight.x;
922 }
923 else if( isModified( m_editPoints->Point( RECT_BOT_LEFT ) ) )
924 {
925 if( aHoleSize.x )
926 {
927 // pin edited point to the bottom/left of the hole
928 aBotLeft.x = std::min( aBotLeft.x, aHole.x - aHoleSize.x / 2 - minWidth );
929 aBotLeft.y = std::max( aBotLeft.y, aHole.y + aHoleSize.y / 2 + minHeight );
930 }
931 else
932 {
933 // pin edited point within opposite corner
934 aBotLeft.x = std::min( aBotLeft.x, aTopRight.x - minWidth );
935 aBotLeft.y = std::max( aBotLeft.y, aTopRight.y + minHeight );
936 }
937
938 // push edited point edges to adjacent corners
939 aBotRight.y = aBotLeft.y;
940 aTopLeft.x = aBotLeft.x;
941 }
942 else if( isModified( m_editPoints->Point( RECT_BOT_RIGHT ) ) )
943 {
944 if( aHoleSize.x )
945 {
946 // pin edited point to the bottom/right of the hole
947 aBotRight.x = std::max( aBotRight.x, aHole.x + aHoleSize.x / 2 + minWidth );
948 aBotRight.y = std::max( aBotRight.y, aHole.y + aHoleSize.y / 2 + minHeight );
949 }
950 else
951 {
952 // pin edited point within opposite corner
953 aBotRight.x = std::max( aBotRight.x, aTopLeft.x + minWidth );
954 aBotRight.y = std::max( aBotRight.y, aTopLeft.y + minHeight );
955 }
956
957 // push edited point edges to adjacent corners
958 aBotLeft.y = aBotRight.y;
959 aTopRight.x = aBotRight.x;
960 }
961 else if( isModified( m_editPoints->Line( RECT_TOP ) ) )
962 {
963 aTopLeft.y = std::min( aTopLeft.y, aBotRight.y - minHeight );
964 }
965 else if( isModified( m_editPoints->Line( RECT_LEFT ) ) )
966 {
967 aTopLeft.x = std::min( aTopLeft.x, aBotRight.x - minWidth );
968 }
969 else if( isModified( m_editPoints->Line( RECT_BOT ) ) )
970 {
971 aBotRight.y = std::max( aBotRight.y, aTopLeft.y + minHeight );
972 }
973 else if( isModified( m_editPoints->Line( RECT_RIGHT ) ) )
974 {
975 aBotRight.x = std::max( aBotRight.x, aTopLeft.x + minWidth );
976 }
977}

References isModified(), m_editPoints, EDA_UNIT_UTILS::Mils2IU(), pcbIUScale, RECT_BOT, RECT_BOT_LEFT, RECT_BOT_RIGHT, RECT_LEFT, RECT_RIGHT, RECT_TOP, RECT_TOP_LEFT, RECT_TOP_RIGHT, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by updateItem().

◆ removeCorner()

int PCB_POINT_EDITOR::removeCorner ( const TOOL_EVENT aEvent)
private

Definition at line 2330 of file pcb_point_editor.cpp.

2331{
2332 if( !m_editPoints || !m_editedPoint )
2333 return 0;
2334
2335 EDA_ITEM* item = m_editPoints->GetParent();
2336
2337 if( !item )
2338 return 0;
2339
2340 SHAPE_POLY_SET* polygon = nullptr;
2341
2342 if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T )
2343 {
2344 ZONE* zone = static_cast<ZONE*>( item );
2345 polygon = zone->Outline();
2346 zone->SetNeedRefill( true );
2347 }
2348 else if( item->Type() == PCB_FP_SHAPE_T || item->Type() == PCB_SHAPE_T )
2349 {
2350 PCB_SHAPE* shape = static_cast<PCB_SHAPE*>( item );
2351
2352 if( shape->GetShape() == SHAPE_T::POLY )
2353 polygon = &shape->GetPolyShape();
2354 }
2355
2356 if( !polygon )
2357 return 0;
2358
2359 PCB_BASE_FRAME* frame = getEditFrame<PCB_BASE_FRAME>();
2360 BOARD_COMMIT commit( frame );
2361 auto vertex = findVertex( *polygon, *m_editedPoint );
2362
2363 if( vertex.first )
2364 {
2365 const auto& vertexIdx = vertex.second;
2366 auto& outline = polygon->Polygon( vertexIdx.m_polygon )[vertexIdx.m_contour];
2367
2368 if( outline.PointCount() > 3 )
2369 {
2370 // the usual case: remove just the corner when there are >3 vertices
2371 commit.Modify( item );
2372 polygon->RemoveVertex( vertexIdx );
2373 validatePolygon( *polygon );
2374 }
2375 else
2376 {
2377 // either remove a hole or the polygon when there are <= 3 corners
2378 if( vertexIdx.m_contour > 0 )
2379 {
2380 // remove hole
2381 commit.Modify( item );
2382 polygon->RemoveContour( vertexIdx.m_contour );
2383 }
2384 else
2385 {
2387 commit.Remove( item );
2388 }
2389 }
2390
2391 setEditedPoint( nullptr );
2392
2393 commit.Push( _( "Remove a zone/polygon corner" ) );
2394
2395 // Refresh zone hatching
2396 if( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T )
2397 static_cast<ZONE*>( item )->HatchBorder();
2398
2399 updatePoints();
2400 }
2401
2402 return 0;
2403}
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
bool validatePolygon(SHAPE_POLY_SET &aModified) const
Validate a polygon and displays a popup warning if invalid.
POLYGON & Polygon(int aIndex)
void RemoveVertex(int aGlobalIndex)
Delete the aGlobalIndex-th vertex.
void RemoveContour(int aContourIdx, int aPolygonIdx=-1)
Delete the aContourIdx-th contour of the aPolygonIdx-th polygon in the set.
static std::pair< bool, SHAPE_POLY_SET::VERTEX_INDEX > findVertex(SHAPE_POLY_SET &aPolySet, const EDIT_POINT &aPoint)

References _, findVertex(), PCB_TOOL_BASE::frame(), EDA_SHAPE::GetPolyShape(), EDA_SHAPE::GetShape(), m_editedPoint, m_editPoints, TOOL_BASE::m_toolMgr, COMMIT::Modify(), ZONE::Outline(), PCB_FP_SHAPE_T, PCB_FP_ZONE_T, PCB_SHAPE_T, PCB_ZONE_T, POLY, SHAPE_POLY_SET::Polygon(), BOARD_COMMIT::Push(), COMMIT::Remove(), SHAPE_POLY_SET::RemoveContour(), SHAPE_POLY_SET::RemoveVertex(), TOOL_MANAGER::RunAction(), PCB_ACTIONS::selectionClear, setEditedPoint(), ZONE::SetNeedRefill(), EDA_ITEM::Type(), updatePoints(), and validatePolygon().

Referenced by setTransitions().

◆ removeCornerCondition()

bool PCB_POINT_EDITOR::removeCornerCondition ( const SELECTION aSelection)
private

Definition at line 2142 of file pcb_point_editor.cpp.

2143{
2144 if( !m_editPoints || !m_editedPoint )
2145 return false;
2146
2147 EDA_ITEM* item = m_editPoints->GetParent();
2148 SHAPE_POLY_SET* polyset = nullptr;
2149
2150 if( !item )
2151 return false;
2152
2153 switch( item->Type() )
2154 {
2155 case PCB_ZONE_T:
2156 case PCB_FP_ZONE_T:
2157 polyset = static_cast<ZONE*>( item )->Outline();
2158 break;
2159
2160 case PCB_SHAPE_T:
2161 case PCB_FP_SHAPE_T:
2162 if( static_cast<PCB_SHAPE*>( item )->GetShape() == SHAPE_T::POLY )
2163 polyset = &static_cast<PCB_SHAPE*>( item )->GetPolyShape();
2164 else
2165 return false;
2166
2167 break;
2168
2169 default:
2170 return false;
2171 }
2172
2173 std::pair<bool, SHAPE_POLY_SET::VERTEX_INDEX> vertex = findVertex( *polyset, *m_editedPoint );
2174
2175 if( !vertex.first )
2176 return false;
2177
2178 const SHAPE_POLY_SET::VERTEX_INDEX& vertexIdx = vertex.second;
2179
2180 // Check if there are enough vertices so one can be removed without
2181 // degenerating the polygon.
2182 // The first condition allows one to remove all corners from holes (when
2183 // there are only 2 vertices left, a hole is removed).
2184 if( vertexIdx.m_contour == 0 &&
2185 polyset->Polygon( vertexIdx.m_polygon )[vertexIdx.m_contour].PointCount() <= 3 )
2186 {
2187 return false;
2188 }
2189
2190 // Remove corner does not work with lines
2191 if( dynamic_cast<EDIT_LINE*>( m_editedPoint ) )
2192 return false;
2193
2194 return m_editedPoint != nullptr;
2195}
Represent a line connecting two EDIT_POINTs.
Definition: edit_points.h:221
Structure to hold the necessary information in order to index a vertex on a SHAPE_POLY_SET object: th...

References findVertex(), EDA_SHAPE::GetPolyShape(), EDA_SHAPE::GetShape(), SHAPE_POLY_SET::VERTEX_INDEX::m_contour, m_editedPoint, m_editPoints, SHAPE_POLY_SET::VERTEX_INDEX::m_polygon, PCB_FP_SHAPE_T, PCB_FP_ZONE_T, PCB_SHAPE_T, PCB_ZONE_T, POLY, SHAPE_POLY_SET::Polygon(), and EDA_ITEM::Type().

Referenced by Init().

◆ Reset()

void PCB_POINT_EDITOR::Reset ( RESET_REASON  aReason)
overridevirtual

Bring 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 119 of file pcb_point_editor.cpp.

120{
121 m_refill = false;
122 m_editPoints.reset();
123 m_altConstraint.reset();
124 getViewControls()->SetAutoPan( false );
125}

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

◆ resetTransitions()

void TOOL_INTERACTIVE::resetTransitions ( )
privateinherited

Clear the current transition map and restores the default one created by setTransitions().

Definition at line 63 of file tool_interactive.cpp.

64{
67}
virtual void setTransitions()=0
This method is meant to be overridden in order to specify handlers for events.
void ClearTransitions(TOOL_BASE *aTool)
Clear the state transition map for a tool.

References TOOL_MANAGER::ClearTransitions(), TOOL_BASE::m_toolMgr, and TOOL_INTERACTIVE::setTransitions().

◆ RunMainStack()

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

Call 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}
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]

PCB_SELECTION & PCB_TOOL_BASE::selection ( )
protectedinherited

Definition at line 324 of file pcb_tool_base.cpp.

325{
327
328 return selTool->GetSelection();
329}

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

◆ selection() [2/2]

const PCB_SELECTION & PCB_TOOL_BASE::selection ( ) const
protectedinherited

Definition at line 316 of file pcb_tool_base.cpp.

317{
319
320 return selTool->GetSelection();
321}

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

Referenced by BOARD_EDITOR_CONTROL::AssignNetclass(), AUTOPLACE_TOOL::autoplaceSelected(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), EDIT_TOOL::ChangeTrackWidth(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), EDIT_TOOL::CreateArray(), DRC_TOOL::CrossProbe(), BOARD_EDITOR_CONTROL::doCrossProbePcbToSch(), BOARD_INSPECTION_TOOL::doHideRatsnestNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::Drag(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawShape(), DRAWING_TOOL::DrawZone(), EDIT_TOOL::Duplicate(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), PAD_TOOL::EditPad(), GROUP_TOOL::EnterGroup(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), EDIT_TOOL::FilletLines(), EDIT_TOOL::FilletTracks(), EDIT_TOOL::Flip(), DRAWING_TOOL::getSourceZoneForAction(), GROUP_TOOL::Group(), BOARD_INSPECTION_TOOL::highlightNet(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), DRAWING_TOOL::InteractivePlaceWithPreview(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_TOOL::MainLoop(), EDIT_TOOL::Mirror(), BOARD_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), OnSelectionChange(), EDIT_TOOL::PackAndMoveFootprints(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), DRAWING_TOOL::PlaceImportedGraphics(), DRAWING_TOOL::PlaceText(), POSITION_RELATIVE_TOOL::PositionRelative(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), BOARD_REANNOTATE_TOOL::ReannotateDuplicatesInSelection(), GROUP_TOOL::RemoveFromGroup(), GLOBAL_EDIT_TOOL::RemoveUnusedPads(), EDIT_TOOL::Rotate(), ROUTER_TOOL::RouteSelected(), DRAWING_TOOL::SetAnchor(), EDIT_TOOL::Swap(), BOARD_EDITOR_CONTROL::TrackWidthDec(), BOARD_EDITOR_CONTROL::TrackWidthInc(), GROUP_TOOL::Ungroup(), BOARD_INSPECTION_TOOL::UpdateLocalRatsnest(), PCB_CONTROL::UpdateMessagePanel(), BOARD_EDITOR_CONTROL::ViaSizeDec(), BOARD_EDITOR_CONTROL::ViaSizeInc(), BOARD_EDITOR_CONTROL::ZoneDuplicate(), ZONE_FILLER_TOOL::ZoneFill(), BOARD_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfill().

◆ setAltConstraint()

void PCB_POINT_EDITOR::setAltConstraint ( bool  aEnabled)
private

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

Definition at line 1987 of file pcb_point_editor.cpp.

1988{
1989 if( aEnabled )
1990 {
1991 EDA_ITEM* parent = m_editPoints->GetParent();
1992 EDIT_LINE* line = dynamic_cast<EDIT_LINE*>( m_editedPoint );
1993 bool isPoly;
1994
1995 switch( parent->Type() )
1996 {
1997 case PCB_ZONE_T:
1998 case PCB_FP_ZONE_T:
1999 isPoly = true;
2000 break;
2001
2002 case PCB_SHAPE_T:
2003 case PCB_FP_SHAPE_T:
2004 isPoly = static_cast<PCB_SHAPE*>( parent )->GetShape() == SHAPE_T::POLY;
2005 break;
2006
2007 default:
2008 isPoly = false;
2009 break;
2010 }
2011
2012 if( line && isPoly )
2013 {
2014 EC_CONVERGING* altConstraint = new EC_CONVERGING( *line, *m_editPoints );
2015 m_altConstraint.reset( (EDIT_CONSTRAINT<EDIT_POINT>*) altConstraint );
2016 }
2017 else
2018 {
2019 // Find a proper constraining point for 45 degrees mode
2022 }
2023 }
2024 else
2025 {
2026 m_altConstraint.reset();
2027 }
2028}
EDIT_CONSTRAINT for 3 segments: dragged and two adjacent ones, enforcing to keep their slopes and all...
EDIT_POINT get45DegConstrainer() const
Condition to display "Create corner" context menu entry.

References get45DegConstrainer(), m_altConstrainer, m_altConstraint, m_editedPoint, m_editPoints, PCB_FP_SHAPE_T, PCB_FP_ZONE_T, PCB_SHAPE_T, PCB_ZONE_T, POLY, and EDA_ITEM::Type().

Referenced by OnSelectionChange().

◆ SetContextMenu()

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

Assign 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}
void SetTool(TOOL_INTERACTIVE *aTool)
Set a tool that is the creator of the menu.
void ScheduleContextMenu(TOOL_BASE *aTool, ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Set behavior of the tool's context popup menu.
@ CMENU_OFF
Definition: tool_event.h:149

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

Referenced by SELECTION_TOOL::doSelectionMenu(), TOOL_MENU::ShowContextMenu(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ setEditedPoint()

void PCB_POINT_EDITOR::setEditedPoint ( EDIT_POINT aPoint)
private

Definition at line 1965 of file pcb_point_editor.cpp.

1966{
1968
1969 if( aPoint )
1970 {
1972 controls->ForceCursorPosition( true, aPoint->GetPosition() );
1973 controls->ShowCursor( true );
1974 }
1975 else
1976 {
1977 if( frame()->ToolStackIsEmpty() )
1978 controls->ShowCursor( false );
1979
1980 controls->ForceCursorPosition( false );
1981 }
1982
1983 m_editedPoint = aPoint;
1984}
An interface for classes handling user events controlling the view behavior such as zooming,...

References ARROW, 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().

◆ SetIsBoardEditor()

void PCB_TOOL_BASE::SetIsBoardEditor ( bool  aEnabled)
inlineinherited

Definition at line 108 of file pcb_tool_base.h.

108{ m_isBoardEditor = aEnabled; }

References PCB_TOOL_BASE::m_isBoardEditor.

◆ SetIsFootprintEditor()

void PCB_TOOL_BASE::SetIsFootprintEditor ( bool  aEnabled)
inlineinherited

Function SetIsFootprintEditor()

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

Parameters
aEnableddecides if the mode should be enabled.

Definition at line 105 of file pcb_tool_base.h.

105{ m_isFootprintEditor = aEnabled; }

References PCB_TOOL_BASE::m_isFootprintEditor.

◆ setTransitions()

void PCB_POINT_EDITOR::setTransitions ( )
overrideprivatevirtual

< Set up handlers for various events.

Reimplemented from PCB_TOOL_BASE.

Definition at line 2448 of file pcb_point_editor.cpp.

2449{
2463}
static TOOL_ACTION activatePointEditor
Definition: actions.h:173
static const TOOL_EVENT SelectedEvent
Definition: actions.h:207
static const TOOL_EVENT UninhibitSelectionEditing
Used to inform tool that it should display the disambiguation menu.
Definition: actions.h:221
static const TOOL_EVENT PointSelectedEvent
Definition: actions.h:206
static const TOOL_EVENT SelectedItemsMoved
Used to inform tools that the selection should temporarily be non-editable.
Definition: actions.h:217
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:208
static TOOL_ACTION pointEditorArcKeepCenter
Definition: pcb_actions.h:248
static TOOL_ACTION pointEditorArcKeepEndpoint
Definition: pcb_actions.h:249
int changeArcEditMode(const TOOL_EVENT &aEvent)
int OnSelectionChange(const TOOL_EVENT &aEvent)
Change selection event handler.
int addCorner(const TOOL_EVENT &aEvent)
TOOL_ACTION handlers.
int modifiedSelection(const TOOL_EVENT &aEvent)
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))
Define which state (aStateFunc) to go when a certain event arrives (aConditions).

References ACTIONS::activatePointEditor, addCorner(), changeArcEditMode(), ACTIONS::cycleArcEditMode, TOOL_INTERACTIVE::Go(), EVENTS::InhibitSelectionEditing, modifiedSelection(), OnSelectionChange(), PCB_ACTIONS::pointEditorAddCorner, PCB_ACTIONS::pointEditorArcKeepCenter, PCB_ACTIONS::pointEditorArcKeepEndpoint, PCB_ACTIONS::pointEditorRemoveCorner, EVENTS::PointSelectedEvent, removeCorner(), EVENTS::SelectedEvent, EVENTS::SelectedItemsModified, EVENTS::SelectedItemsMoved, EVENTS::UninhibitSelectionEditing, and EVENTS::UnselectedEvent.

◆ updateEditedPoint()

void PCB_POINT_EDITOR::updateEditedPoint ( const TOOL_EVENT aEvent)
private

Set the current point being edited. NULL means none.

Definition at line 419 of file pcb_point_editor.cpp.

420{
421 EDIT_POINT* point;
422 EDIT_POINT* hovered = nullptr;
423
424 if( aEvent.IsMotion() )
425 {
426 point = m_editPoints->FindPoint( aEvent.Position(), getView() );
427 hovered = point;
428 }
429 else if( aEvent.IsDrag( BUT_LEFT ) )
430 {
431 point = m_editPoints->FindPoint( aEvent.DragOrigin(), getView() );
432 }
433 else
434 {
435 point = m_editPoints->FindPoint( getViewControls()->GetCursorPosition(), getView() );
436 }
437
438 if( hovered )
439 {
440 if( m_hoveredPoint != hovered )
441 {
442 if( m_hoveredPoint )
443 m_hoveredPoint->SetHover( false );
444
445 m_hoveredPoint = hovered;
447 }
448 }
449 else if( m_hoveredPoint )
450 {
451 m_hoveredPoint->SetHover( false );
452 m_hoveredPoint = nullptr;
453 }
454
455 if( m_editedPoint != point )
456 setEditedPoint( point );
457}
void SetHover(bool aHover=true)
Definition: edit_points.h:176
const VECTOR2D Position() const
Returns the point where dragging has started.
Definition: tool_event.h:266
bool IsDrag(int aButtonMask=BUT_ANY) const
Definition: tool_event.h:288
const VECTOR2D DragOrigin() const
Returns information about mouse buttons state.
Definition: tool_event.h:272
bool IsMotion() const
Definition: tool_event.h:303

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

Referenced by OnSelectionChange().

◆ updateItem()

void PCB_POINT_EDITOR::updateItem ( ) const
private

Definition at line 1086 of file pcb_point_editor.cpp.

1087{
1088 EDA_ITEM* item = m_editPoints->GetParent();
1089
1090 if( !item )
1091 return;
1092
1093 switch( item->Type() )
1094 {
1095 case PCB_BITMAP_T:
1096 {
1097 PCB_BITMAP* bitmap = (PCB_BITMAP*) item;
1098 VECTOR2I topLeft = m_editPoints->Point( RECT_TOP_LEFT ).GetPosition();
1099 VECTOR2I topRight = m_editPoints->Point( RECT_TOP_RIGHT ).GetPosition();
1100 VECTOR2I botLeft = m_editPoints->Point( RECT_BOT_LEFT ).GetPosition();
1101 VECTOR2I botRight = m_editPoints->Point( RECT_BOT_RIGHT ).GetPosition();
1102
1103 pinEditedCorner( topLeft, topRight, botLeft, botRight );
1104
1105 double oldWidth = bitmap->GetSize().x;
1106 double newWidth = std::max( topRight.x - topLeft.x, EDA_UNIT_UTILS::Mils2IU( pcbIUScale, 50 ) );
1107 double widthRatio = newWidth / oldWidth;
1108
1109 double oldHeight = bitmap->GetSize().y;
1110 double newHeight =
1111 std::max( botLeft.y - topLeft.y, EDA_UNIT_UTILS::Mils2IU( pcbIUScale, 50 ) );
1112 double heightRatio = newHeight / oldHeight;
1113
1114 bitmap->SetImageScale( bitmap->GetImageScale() * std::min( widthRatio, heightRatio ) );
1115
1116 break;
1117 }
1118
1119 case PCB_TEXTBOX_T:
1120 case PCB_FP_TEXTBOX_T:
1121 case PCB_SHAPE_T:
1122 case PCB_FP_SHAPE_T:
1123 {
1124 PCB_SHAPE* shape = static_cast<PCB_SHAPE*>( item );
1125
1126 switch( shape->GetShape() )
1127 {
1128 case SHAPE_T::SEGMENT:
1129 if( isModified( m_editPoints->Point( SEG_START ) ) )
1130 shape->SetStart( m_editPoints->Point( SEG_START ).GetPosition() );
1131 else if( isModified( m_editPoints->Point( SEG_END ) ) )
1132 shape->SetEnd( m_editPoints->Point( SEG_END ).GetPosition() );
1133
1134 break;
1135
1136 case SHAPE_T::RECT:
1137 {
1138 VECTOR2I topLeft = m_editPoints->Point( RECT_TOP_LEFT ).GetPosition();
1139 VECTOR2I topRight = m_editPoints->Point( RECT_TOP_RIGHT ).GetPosition();
1140 VECTOR2I botLeft = m_editPoints->Point( RECT_BOT_LEFT ).GetPosition();
1141 VECTOR2I botRight = m_editPoints->Point( RECT_BOT_RIGHT ).GetPosition();
1142
1143 pinEditedCorner( topLeft, topRight, botLeft, botRight );
1144
1145 if( isModified( m_editPoints->Point( RECT_TOP_LEFT ) )
1146 || isModified( m_editPoints->Point( RECT_TOP_RIGHT ) )
1147 || isModified( m_editPoints->Point( RECT_BOT_RIGHT ) )
1148 || isModified( m_editPoints->Point( RECT_BOT_LEFT ) ) )
1149 {
1150 shape->SetLeft( topLeft.x );
1151 shape->SetTop( topLeft.y );
1152 shape->SetRight( botRight.x );
1153 shape->SetBottom( botRight.y );
1154 }
1155 else if( isModified( m_editPoints->Line( RECT_TOP ) ) )
1156 {
1157 shape->SetTop( topLeft.y );
1158 }
1159 else if( isModified( m_editPoints->Line( RECT_LEFT ) ) )
1160 {
1161 shape->SetLeft( topLeft.x );
1162 }
1163 else if( isModified( m_editPoints->Line( RECT_BOT ) ) )
1164 {
1165 shape->SetBottom( botRight.y );
1166 }
1167 else if( isModified( m_editPoints->Line( RECT_RIGHT ) ) )
1168 {
1169 shape->SetRight( botRight.x );
1170 }
1171
1172 for( unsigned i = 0; i < m_editPoints->LinesSize(); ++i )
1173 {
1174 if( !isModified( m_editPoints->Line( i ) ) )
1175 {
1176 m_editPoints->Line( i ).SetConstraint(
1177 new EC_PERPLINE( m_editPoints->Line( i ) ) );
1178 }
1179 }
1180
1181 break;
1182 }
1183
1184 case SHAPE_T::ARC:
1185 {
1186 VECTOR2I center = m_editPoints->Point( ARC_CENTER ).GetPosition();
1187 VECTOR2I mid = m_editPoints->Point( ARC_MID ).GetPosition();
1188 VECTOR2I start = m_editPoints->Point( ARC_START ).GetPosition();
1189 VECTOR2I end = m_editPoints->Point( ARC_END ).GetPosition();
1190
1191 if( isModified( m_editPoints->Point( ARC_CENTER ) ) )
1192 {
1194 {
1195 editArcCenterKeepEndpoints( shape, center, start, mid, end );
1196 }
1197 else
1198 {
1199 VECTOR2I moveVector = VECTOR2I( center.x, center.y ) - shape->GetCenter();
1200 shape->Move( moveVector );
1201 }
1202 }
1203 else if( isModified( m_editPoints->Point( ARC_MID ) ) )
1204 {
1205 const VECTOR2I& cursorPos = getViewControls()->GetCursorPosition( false );
1206
1208 editArcMidKeepEndpoints( shape, start, end, cursorPos );
1209 else
1210 editArcMidKeepCenter( shape, center, start, mid, end, cursorPos );
1211 }
1212 else if( isModified( m_editPoints->Point( ARC_START ) )
1213 || isModified( m_editPoints->Point( ARC_END ) ) )
1214 {
1215 const VECTOR2I& cursorPos = getViewControls()->GetCursorPosition();
1216
1218 editArcEndpointKeepTangent( shape, center, start, mid, end, cursorPos );
1219 else
1220 editArcEndpointKeepCenter( shape, center, start, mid, end, cursorPos );
1221 }
1222
1223 break;
1224 }
1225
1226 case SHAPE_T::CIRCLE:
1227 {
1228 const VECTOR2I& center = m_editPoints->Point( CIRC_CENTER ).GetPosition();
1229 const VECTOR2I& end = m_editPoints->Point( CIRC_END ).GetPosition();
1230
1231 if( isModified( m_editPoints->Point( CIRC_CENTER ) ) )
1232 {
1233 VECTOR2I moveVector = VECTOR2I( center.x, center.y ) - shape->GetCenter();
1234 shape->Move( moveVector );
1235 }
1236 else
1237 {
1238 shape->SetEnd( VECTOR2I( end.x, end.y ) );
1239 }
1240
1241 break;
1242 }
1243
1244 case SHAPE_T::POLY:
1245 {
1246 SHAPE_POLY_SET& outline = shape->GetPolyShape();
1247
1248 for( int i = 0; i < outline.TotalVertices(); ++i )
1249 outline.SetVertex( i, m_editPoints->Point( i ).GetPosition() );
1250
1251 for( unsigned i = 0; i < m_editPoints->LinesSize(); ++i )
1252 {
1253 if( !isModified( m_editPoints->Line( i ) ) )
1254 m_editPoints->Line( i ).SetConstraint(
1255 new EC_PERPLINE( m_editPoints->Line( i ) ) );
1256 }
1257
1258 validatePolygon( outline );
1259 break;
1260 }
1261
1262 case SHAPE_T::BEZIER:
1263 if( isModified( m_editPoints->Point( BEZIER_CURVE_START ) ) )
1264 shape->SetStart( m_editPoints->Point( BEZIER_CURVE_START ).GetPosition() );
1266 shape->SetBezierC1( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ).GetPosition() );
1268 shape->SetBezierC2( m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ).GetPosition() );
1269 else if( isModified( m_editPoints->Point( BEZIER_CURVE_END ) ) )
1270 shape->SetEnd( m_editPoints->Point( BEZIER_CURVE_END ).GetPosition() );
1271
1273 break;
1274
1275 default: // suppress warnings
1276 break;
1277 }
1278
1279 if( FP_SHAPE* fpShape = dynamic_cast<FP_SHAPE*>( item ) )
1280 {
1281 // Update relative coordinates for footprint shapes
1282 fpShape->SetLocalCoord();
1283
1284 if( fpShape->IsAnnotationProxy() )
1285 {
1286 for( PAD* pad : fpShape->GetParentFootprint()->Pads() )
1287 {
1288 if( pad->GetFlags() & ENTERED )
1289 view()->Update( pad );
1290 }
1291 }
1292 }
1293
1294 // Nuke outline font render caches
1295 if( PCB_TEXTBOX* textBox = dynamic_cast<PCB_TEXTBOX*>( item ) )
1296 textBox->ClearRenderCache();
1297 else if( FP_TEXTBOX* fpTextBox = dynamic_cast<FP_TEXTBOX*>( item ) )
1298 fpTextBox->ClearRenderCache();
1299
1300 break;
1301 }
1302
1303 case PCB_PAD_T:
1304 {
1305 PAD* pad = static_cast<PAD*>( item );
1306
1307 switch( pad->GetShape() )
1308 {
1309 case PAD_SHAPE::CIRCLE:
1310 {
1311 VECTOR2I end = m_editPoints->Point( 0 ).GetPosition();
1312 int diameter = (int) EuclideanNorm( end - pad->GetPosition() ) * 2;
1313
1314 pad->SetSize( VECTOR2I( diameter, diameter ) );
1315 break;
1316 }
1317
1318 case PAD_SHAPE::OVAL:
1320 case PAD_SHAPE::RECT:
1323 {
1324 VECTOR2I topLeft = m_editPoints->Point( RECT_TOP_LEFT ).GetPosition();
1325 VECTOR2I topRight = m_editPoints->Point( RECT_TOP_RIGHT ).GetPosition();
1326 VECTOR2I botLeft = m_editPoints->Point( RECT_BOT_LEFT ).GetPosition();
1327 VECTOR2I botRight = m_editPoints->Point( RECT_BOT_RIGHT ).GetPosition();
1328 VECTOR2I holeCenter = pad->GetPosition();
1329 VECTOR2I holeSize = pad->GetDrillSize();
1330
1331 pinEditedCorner( topLeft, topRight, botLeft, botRight, holeCenter, holeSize );
1332
1333 if( ( pad->GetOffset().x || pad->GetOffset().y )
1334 || ( pad->GetDrillSize().x && pad->GetDrillSize().y ) )
1335 {
1336 // Keep hole pinned at the current location; adjust the pad around the hole
1337
1338 VECTOR2I center = pad->GetPosition();
1339 int dist[4];
1340
1341 if( isModified( m_editPoints->Point( RECT_TOP_LEFT ) )
1342 || isModified( m_editPoints->Point( RECT_BOT_RIGHT ) ) )
1343 {
1344 dist[0] = center.x - topLeft.x;
1345 dist[1] = center.y - topLeft.y;
1346 dist[2] = botRight.x - center.x;
1347 dist[3] = botRight.y - center.y;
1348 }
1349 else
1350 {
1351 dist[0] = center.x - botLeft.x;
1352 dist[1] = center.y - topRight.y;
1353 dist[2] = topRight.x - center.x;
1354 dist[3] = botLeft.y - center.y;
1355 }
1356
1357 VECTOR2I padSize( dist[0] + dist[2], dist[1] + dist[3] );
1358 VECTOR2I deltaOffset( padSize.x / 2 - dist[2], padSize.y / 2 - dist[3] );
1359
1360 if( pad->GetOrientation() == ANGLE_90 || pad->GetOrientation() == ANGLE_270 )
1361 std::swap( padSize.x, padSize.y );
1362
1363 RotatePoint( deltaOffset, -pad->GetOrientation() );
1364
1365 pad->SetSize( padSize );
1366 pad->SetOffset( -deltaOffset );
1367 }
1368 else
1369 {
1370 // Keep pad position at the center of the pad shape
1371
1372 int left, top, right, bottom;
1373
1374 if( isModified( m_editPoints->Point( RECT_TOP_LEFT ) )
1375 || isModified( m_editPoints->Point( RECT_BOT_RIGHT ) ) )
1376 {
1377 left = topLeft.x;
1378 top = topLeft.y;
1379 right = botRight.x;
1380 bottom = botRight.y;
1381 }
1382 else
1383 {
1384 left = botLeft.x;
1385 top = topRight.y;
1386 right = topRight.x;
1387 bottom = botLeft.y;
1388 }
1389
1390 VECTOR2I padSize( abs( right - left ), abs( bottom - top ) );
1391
1392 if( pad->GetOrientation() == ANGLE_90 || pad->GetOrientation() == ANGLE_270 )
1393 std::swap( padSize.x, padSize.y );
1394
1395 pad->SetSize( padSize );
1396 pad->SetPosition( VECTOR2I( ( left + right ) / 2, ( top + bottom ) / 2 ) );
1397 pad->SetLocalCoord();
1398 }
1399 break;
1400 }
1401
1402 default: // suppress warnings
1403 break;
1404 }
1405
1406 break;
1407 }
1408
1409 case PCB_FP_ZONE_T:
1410 case PCB_ZONE_T:
1411 {
1412 ZONE* zone = static_cast<ZONE*>( item );
1413 zone->UnFill();
1414 SHAPE_POLY_SET& outline = *zone->Outline();
1415
1416 for( int i = 0; i < outline.TotalVertices(); ++i )
1417 {
1418 if( outline.CVertex( i ) != m_editPoints->Point( i ).GetPosition() )
1419 zone->SetNeedRefill( true );
1420
1421 outline.SetVertex( i, m_editPoints->Point( i ).GetPosition() );
1422 }
1423
1424 for( unsigned i = 0; i < m_editPoints->LinesSize(); ++i )
1425 {
1426 if( !isModified( m_editPoints->Line( i ) ) )
1427 m_editPoints->Line( i ).SetConstraint( new EC_PERPLINE( m_editPoints->Line( i ) ) );
1428 }
1429
1430 validatePolygon( outline );
1431 zone->HatchBorder();
1432
1433 // TODO Refill zone when KiCad supports auto re-fill
1434 break;
1435 }
1436
1437 case PCB_DIM_ALIGNED_T:
1439 {
1440 PCB_DIM_ALIGNED* dimension = static_cast<PCB_DIM_ALIGNED*>( item );
1441
1442 // Check which point is currently modified and updated dimension's points respectively
1443 if( isModified( m_editPoints->Point( DIM_CROSSBARSTART ) ) )
1444 {
1445 VECTOR2D featureLine( m_editedPoint->GetPosition() - dimension->GetStart() );
1446 VECTOR2D crossBar( dimension->GetEnd() - dimension->GetStart() );
1447
1448 if( featureLine.Cross( crossBar ) > 0 )
1449 dimension->SetHeight( -featureLine.EuclideanNorm() );
1450 else
1451 dimension->SetHeight( featureLine.EuclideanNorm() );
1452
1453 dimension->Update();
1454 }
1455 else if( isModified( m_editPoints->Point( DIM_CROSSBAREND ) ) )
1456 {
1457 VECTOR2D featureLine( m_editedPoint->GetPosition() - dimension->GetEnd() );
1458 VECTOR2D crossBar( dimension->GetEnd() - dimension->GetStart() );
1459
1460 if( featureLine.Cross( crossBar ) > 0 )
1461 dimension->SetHeight( -featureLine.EuclideanNorm() );
1462 else
1463 dimension->SetHeight( featureLine.EuclideanNorm() );
1464
1465 dimension->Update();
1466 }
1467 else if( isModified( m_editPoints->Point( DIM_START ) ) )
1468 {
1469 dimension->SetStart( m_editedPoint->GetPosition() );
1470 dimension->Update();
1471
1473 SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBARSTART ),
1474 m_editPoints->Point( DIM_START ) ) );
1475 m_editPoints->Point( DIM_CROSSBAREND ).
1476 SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBAREND ),
1477 m_editPoints->Point( DIM_END ) ) );
1478 }
1479 else if( isModified( m_editPoints->Point( DIM_END ) ) )
1480 {
1481 dimension->SetEnd( m_editedPoint->GetPosition() );
1482 dimension->Update();
1483
1485 SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBARSTART ),
1486 m_editPoints->Point( DIM_START ) ) );
1487 m_editPoints->Point( DIM_CROSSBAREND ).
1488 SetConstraint( new EC_LINE( m_editPoints->Point( DIM_CROSSBAREND ),
1489 m_editPoints->Point( DIM_END ) ) );
1490 }
1491 else if( isModified( m_editPoints->Point(DIM_TEXT ) ) )
1492 {
1493 // Force manual mode if we weren't already in it
1495 dimension->SetTextPos( m_editedPoint->GetPosition() );
1496 dimension->Update();
1497 }
1498
1499 break;
1500 }
1501
1504 {
1505 PCB_DIM_ORTHOGONAL* dimension = static_cast<PCB_DIM_ORTHOGONAL*>( item );
1506
1507 if( isModified( m_editPoints->Point( DIM_CROSSBARSTART ) ) ||
1509 {
1510 BOX2I bounds( dimension->GetStart(), dimension->GetEnd() - dimension->GetStart() );
1511
1512 const VECTOR2I& cursorPos = m_editedPoint->GetPosition();
1513
1514 // Find vector from nearest dimension point to edit position
1515 VECTOR2I directionA( cursorPos - dimension->GetStart() );
1516 VECTOR2I directionB( cursorPos - dimension->GetEnd() );
1517 VECTOR2I direction = ( directionA < directionB ) ? directionA : directionB;
1518
1519 bool vert;
1520 VECTOR2D featureLine( cursorPos - dimension->GetStart() );
1521
1522 // Only change the orientation when we move outside the bounds
1523 if( !bounds.Contains( cursorPos ) )
1524 {
1525 // If the dimension is horizontal or vertical, set correct orientation
1526 // otherwise, test if we're left/right of the bounding box or above/below it
1527 if( bounds.GetWidth() == 0 )
1528 vert = true;
1529 else if( bounds.GetHeight() == 0 )
1530 vert = false;
1531 else if( cursorPos.x > bounds.GetLeft() && cursorPos.x < bounds.GetRight() )
1532 vert = false;
1533 else if( cursorPos.y > bounds.GetTop() && cursorPos.y < bounds.GetBottom() )
1534 vert = true;
1535 else
1536 vert = std::abs( direction.y ) < std::abs( direction.x );
1537
1540 }
1541 else
1542 {
1544 }
1545
1546 dimension->SetHeight( vert ? featureLine.x : featureLine.y );
1547 }
1548 else if( isModified( m_editPoints->Point( DIM_START ) ) )
1549 {
1550 dimension->SetStart( m_editedPoint->GetPosition() );
1551 }
1552 else if( isModified( m_editPoints->Point( DIM_END ) ) )
1553 {
1554 dimension->SetEnd( m_editedPoint->GetPosition() );
1555 }
1556 else if( isModified( m_editPoints->Point(DIM_TEXT ) ) )
1557 {
1558 // Force manual mode if we weren't already in it
1560 dimension->SetTextPos( VECTOR2I( m_editedPoint->GetPosition() ) );
1561 }
1562
1563 dimension->Update();
1564
1565 break;
1566 }
1567
1568 case PCB_DIM_CENTER_T:
1570 {
1571 PCB_DIM_CENTER* dimension = static_cast<PCB_DIM_CENTER*>( item );
1572
1573 if( isModified( m_editPoints->Point( DIM_START ) ) )
1574 dimension->SetStart( m_editedPoint->GetPosition() );
1575 else if( isModified( m_editPoints->Point( DIM_END ) ) )
1576 dimension->SetEnd( m_editedPoint->GetPosition() );
1577
1578 dimension->Update();
1579
1580 break;
1581 }
1582
1583 case PCB_DIM_RADIAL_T:
1585 {
1586 PCB_DIM_RADIAL* dimension = static_cast<PCB_DIM_RADIAL*>( item );
1587
1588 if( isModified( m_editPoints->Point( DIM_START ) ) )
1589 {
1590 dimension->SetStart( m_editedPoint->GetPosition() );
1591 dimension->Update();
1592
1593 m_editPoints->Point( DIM_KNEE ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_START ),
1594 m_editPoints->Point( DIM_END ) ) );
1595 }
1596 else if( isModified( m_editPoints->Point( DIM_END ) ) )
1597 {
1598 VECTOR2I oldKnee = dimension->GetKnee();
1599
1600 dimension->SetEnd( m_editedPoint->GetPosition() );
1601 dimension->Update();
1602
1603 VECTOR2I kneeDelta = dimension->GetKnee() - oldKnee;
1604 dimension->SetTextPos( dimension->GetTextPos() + kneeDelta );
1605 dimension->Update();
1606
1607 m_editPoints->Point( DIM_KNEE ).SetConstraint( new EC_LINE( m_editPoints->Point( DIM_START ),
1608 m_editPoints->Point( DIM_END ) ) );
1609 }
1610 else if( isModified( m_editPoints->Point( DIM_KNEE ) ) )
1611 {
1612 VECTOR2I oldKnee = dimension->GetKnee();
1613 VECTOR2I arrowVec = m_editPoints->Point( DIM_KNEE ).GetPosition()
1614 - m_editPoints->Point( DIM_END ).GetPosition();
1615
1616 dimension->SetLeaderLength( arrowVec.EuclideanNorm() );
1617 dimension->Update();
1618
1619 VECTOR2I kneeDelta = dimension->GetKnee() - oldKnee;
1620 dimension->SetTextPos( dimension->GetTextPos() + kneeDelta );
1621 dimension->Update();
1622 }
1623 else if( isModified( m_editPoints->Point( DIM_TEXT ) ) )
1624 {
1625 dimension->SetTextPos( m_editedPoint->GetPosition() );
1626 dimension->Update();
1627 }
1628
1629 break;
1630 }
1631
1632 case PCB_DIM_LEADER_T:
1634 {
1635 PCB_DIM_LEADER* dimension = static_cast<PCB_DIM_LEADER*>( item );
1636
1637 if( isModified( m_editPoints->Point( DIM_START ) ) )
1638 {
1639 dimension->SetStart( (VECTOR2I) m_editedPoint->GetPosition() );
1640 }
1641 else if( isModified( m_editPoints->Point( DIM_END ) ) )
1642 {
1643 VECTOR2I newPoint( m_editedPoint->GetPosition() );
1644 VECTOR2I delta = newPoint - dimension->GetEnd();
1645
1646 dimension->SetEnd( newPoint );
1647 dimension->SetTextPos( dimension->GetTextPos() + delta );
1648 }
1649 else if( isModified( m_editPoints->Point( DIM_TEXT ) ) )
1650 {
1651 dimension->SetTextPos( (VECTOR2I) m_editedPoint->GetPosition() );
1652 }
1653
1654 dimension->Update();
1655
1656 break;
1657 }
1658
1659 default:
1660 break;
1661 }
1662
1663 getView()->Update( item );
1664
1665 frame()->SetMsgPanel( item );
1666}
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
void SetBezierC2(const VECTOR2I &aPt)
Definition: eda_shape.h:178
void RebuildBezierToSegmentsPointsList(int aMinSegLen)
Rebuild the m_bezierPoints vertex list that approximate the Bezier curve by a list of segments.
Definition: eda_shape.cpp:405
virtual void SetBottom(int val)
Definition: eda_shape.h:173
virtual void SetTop(int val)
Definition: eda_shape.h:170
int GetWidth() const
Definition: eda_shape.h:109
void SetBezierC1(const VECTOR2I &aPt)
Definition: eda_shape.h:175
virtual void SetLeft(int val)
Definition: eda_shape.h:171
virtual void SetRight(int val)
Definition: eda_shape.h:172
void SetTextPos(const VECTOR2I &aPoint)
Definition: eda_text.cpp:373
void SetImageScale(double aScale)
Definition: pcb_bitmap.h:77
double GetImageScale() const
Definition: pcb_bitmap.h:75
void Update()
Update the dimension's cached text and geometry.
void SetTextPositionMode(DIM_TEXT_POSITION aMode)
virtual void SetEnd(const VECTOR2I &aPoint)
virtual void SetStart(const VECTOR2I &aPoint)
void SetHeight(int aHeight)
Set the distance from the feature points to the crossbar line.
An orthogonal dimension is like an aligned dimension, but the extension lines are locked to the X or ...
void SetOrientation(DIR aOrientation)
Set the orientation of the dimension line (so, perpendicular to the feature lines).
DIR GetOrientation() const
void SetLeaderLength(int aLength)
void pinEditedCorner(VECTOR2I &aTopLeft, VECTOR2I &aTopRight, VECTOR2I &aBotLeft, VECTOR2I &aBotRight, const VECTOR2I &aHole={ 0, 0 }, const VECTOR2I &aHoleSize={ 0, 0 }) const
Set up an alternative constraint (typically enabled upon a modifier key being pressed).
void editArcMidKeepEndpoints(PCB_SHAPE *aArc, const VECTOR2I &aStart, const VECTOR2I &aEnd, const VECTOR2I &aCursor) const
Move the mid point of the arc, while keeping the two endpoints.
void editArcMidKeepCenter(PCB_SHAPE *aArc, const VECTOR2I &aCenter, const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd, const VECTOR2I &aCursor) const
Move the mid point of the arc, while keeping the angle.
void editArcEndpointKeepTangent(PCB_SHAPE *aArc, const VECTOR2I &aCenter, const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd, const VECTOR2I &aCursor) const
Move an end point of the arc, while keeping the tangent at the other endpoint.
void editArcCenterKeepEndpoints(PCB_SHAPE *aArc, const VECTOR2I &aCenter, const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd) const
Move the arc center but keep endpoint locations.
void editArcEndpointKeepCenter(PCB_SHAPE *aArc, const VECTOR2I &aCenter, const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd, const VECTOR2I &aCursor) const
Move an end point of the arc around the circumference.
virtual void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: pcb_shape.cpp:163
void SetVertex(const VERTEX_INDEX &aIndex, const VECTOR2I &aPos)
Accessor function to set the position of a specific point.
bool UnFill()
Removes the zone filling.
Definition: zone.cpp:215
#define ENTERED
indicates a group has been entered
@ MANUAL
Text placement is manually set by the user.
@ BEZIER_CURVE_START
@ BEZIER_CURVE_CONTROL_POINT2
@ BEZIER_CURVE_END
@ BEZIER_CURVE_CONTROL_POINT1
@ ARC_START
@ ARC_END
@ ARC_CENTER
@ CIRC_END
@ SEG_END
@ SEG_START
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Definition: trigo.cpp:183

References std::abs(), ANGLE_270, ANGLE_90, ARC, ARC_CENTER, ARC_END, ARC_START, BEZIER, BEZIER_CURVE_CONTROL_POINT1, BEZIER_CURVE_CONTROL_POINT2, BEZIER_CURVE_END, BEZIER_CURVE_START, CHAMFERED_RECT, CIRC_CENTER, CIRC_END, CIRCLE, BOX2< Vec >::Contains(), VECTOR2< T >::Cross(), SHAPE_POLY_SET::CVertex(), delta, DIM_CROSSBAREND, DIM_CROSSBARSTART, DIM_END, DIM_KNEE, DIM_START, DIM_TEXT, editArcCenterKeepEndpoints(), editArcEndpointKeepCenter(), editArcEndpointKeepTangent(), editArcMidKeepCenter(), editArcMidKeepEndpoints(), ENTERED, VECTOR2< T >::EuclideanNorm(), EuclideanNorm(), PCB_TOOL_BASE::frame(), BOX2< Vec >::GetBottom(), PCB_SHAPE::GetCenter(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), PCB_DIMENSION_BASE::GetEnd(), BOX2< Vec >::GetHeight(), PCB_BITMAP::GetImageScale(), PCB_DIM_RADIAL::GetKnee(), BOX2< Vec >::GetLeft(), PCB_DIM_ORTHOGONAL::GetOrientation(), EDA_SHAPE::GetPolyShape(), EDIT_POINT::GetPosition(), BOX2< Vec >::GetRight(), EDA_SHAPE::GetShape(), PCB_BITMAP::GetSize(), PCB_DIMENSION_BASE::GetStart(), EDA_TEXT::GetTextPos(), BOX2< Vec >::GetTop(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), EDA_SHAPE::GetWidth(), BOX2< Vec >::GetWidth(), ZONE::HatchBorder(), PCB_DIM_ORTHOGONAL::HORIZONTAL, isModified(), KEEP_ENDPOINTS_OR_START_DIRECTION, left, m_arcEditMode, m_editedPoint, m_editPoints, MANUAL, EDA_UNIT_UTILS::Mils2IU(), PCB_SHAPE::Move(), ZONE::Outline(), OVAL, pad, PCB_BITMAP_T, PCB_DIM_ALIGNED_T, PCB_DIM_CENTER_T, PCB_DIM_LEADER_T, PCB_DIM_ORTHOGONAL_T, PCB_DIM_RADIAL_T, PCB_FP_DIM_ALIGNED_T, PCB_FP_DIM_CENTER_T, PCB_FP_DIM_LEADER_T, PCB_FP_DIM_ORTHOGONAL_T, PCB_FP_DIM_RADIAL_T, PCB_FP_SHAPE_T, PCB_FP_TEXTBOX_T, PCB_FP_ZONE_T, PCB_PAD_T, PCB_SHAPE_T, PCB_TEXTBOX_T, PCB_ZONE_T, pcbIUScale, pinEditedCorner(), POLY, EDA_SHAPE::RebuildBezierToSegmentsPointsList(), RECT, RECT_BOT, RECT_BOT_LEFT, RECT_BOT_RIGHT, RECT_LEFT, RECT_RIGHT, RECT_TOP, RECT_TOP_LEFT, RECT_TOP_RIGHT, right, RotatePoint(), ROUNDRECT, SEG_END, SEG_START, SEGMENT, EDA_SHAPE::SetBezierC1(), EDA_SHAPE::SetBezierC2(), EDA_SHAPE::SetBottom(), EDA_SHAPE::SetEnd(), PCB_DIMENSION_BASE::SetEnd(), PCB_DIM_ALIGNED::SetHeight(), PCB_BITMAP::SetImageScale(), PCB_DIM_RADIAL::SetLeaderLength(), EDA_SHAPE::SetLeft(), EDA_DRAW_FRAME::SetMsgPanel(), ZONE::SetNeedRefill(), PCB_DIM_ORTHOGONAL::SetOrientation(), EDA_SHAPE::SetRight(), PCB_DIMENSION_BASE::SetStart(), EDA_SHAPE::SetStart(), EDA_TEXT::SetTextPos(), PCB_DIMENSION_BASE::SetTextPositionMode(), EDA_SHAPE::SetTop(), SHAPE_POLY_SET::SetVertex(), SHAPE_POLY_SET::TotalVertices(), TRAPEZOID, EDA_ITEM::Type(), ZONE::UnFill(), PCB_DIMENSION_BASE::Update(), KIGFX::VIEW::Update(), KIGFX::PCB_VIEW::Update(), validatePolygon(), PCB_DIM_ORTHOGONAL::VERTICAL, PCB_TOOL_BASE::view(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by OnSelectionChange().

◆ updatePoints()

void PCB_POINT_EDITOR::updatePoints ( )
private

Update which point is being edited.

Definition at line 1675 of file pcb_point_editor.cpp.

1676{
1677 if( !m_editPoints )
1678 return;
1679
1680 EDA_ITEM* item = m_editPoints->GetParent();
1681
1682 if( !item )
1683 return;
1684
1685 switch( item->Type() )
1686 {
1687 case PCB_BITMAP_T:
1688 {
1689 PCB_BITMAP* bitmap = (PCB_BITMAP*) item;
1690 VECTOR2I topLeft = bitmap->GetPosition() - bitmap->GetSize() / 2;
1691 VECTOR2I botRight = bitmap->GetPosition() + bitmap->GetSize() / 2;
1692
1693 m_editPoints->Point( RECT_TOP_LEFT ).SetPosition( topLeft );
1694 m_editPoints->Point( RECT_TOP_RIGHT ).SetPosition( botRight.x, topLeft.y );
1695 m_editPoints->Point( RECT_BOT_LEFT ).SetPosition( topLeft.x, botRight.y );
1696 m_editPoints->Point( RECT_BOT_RIGHT ).SetPosition( botRight );
1697
1698 break;
1699 }
1700
1701 case PCB_TEXTBOX_T:
1702 case PCB_FP_TEXTBOX_T:
1703 {
1704 const PCB_SHAPE* shape = static_cast<const PCB_SHAPE*>( item );
1705 int target = shape->GetShape() == SHAPE_T::RECT ? 4 : 0;
1706
1707 // Careful; textbox shape is mutable between cardinal and non-cardinal rotations...
1708 if( int( m_editPoints->PointsSize() ) != target )
1709 {
1710 getView()->Remove( m_editPoints.get() );
1711 m_editedPoint = nullptr;
1712
1713 m_editPoints = makePoints( item );
1714
1715 if( m_editPoints )
1716 getView()->Add( m_editPoints.get() );
1717
1718 break;
1719 }
1720
1721 if( shape->GetShape() == SHAPE_T::RECT )
1722 {
1723 m_editPoints->Point( RECT_TOP_LEFT ).SetPosition( shape->GetTopLeft() );
1724 m_editPoints->Point( RECT_TOP_RIGHT ).SetPosition( shape->GetBotRight().x,
1725 shape->GetTopLeft().y );
1726 m_editPoints->Point( RECT_BOT_RIGHT ).SetPosition( shape->GetBotRight() );
1727 m_editPoints->Point( RECT_BOT_LEFT ).SetPosition( shape->GetTopLeft().x,
1728 shape->GetBotRight().y );
1729 }
1730 else if( shape->GetShape() == SHAPE_T::POLY )
1731 {
1732 // Not currently editable while rotated.
1733 }
1734
1735 break;
1736 }
1737
1738 case PCB_SHAPE_T:
1739 case PCB_FP_SHAPE_T:
1740 {
1741 const PCB_SHAPE* shape = static_cast<const PCB_SHAPE*>( item );
1742
1743 switch( shape->GetShape() )
1744 {
1745 case SHAPE_T::SEGMENT:
1746 m_editPoints->Point( SEG_START ).SetPosition( shape->GetStart() );
1747 m_editPoints->Point( SEG_END ).SetPosition( shape->GetEnd() );
1748 break;
1749
1750 case SHAPE_T::RECT:
1751 m_editPoints->Point( RECT_TOP_LEFT ).SetPosition( shape->GetTopLeft() );
1752 m_editPoints->Point( RECT_TOP_RIGHT ).SetPosition( shape->GetBotRight().x,
1753 shape->GetTopLeft().y );
1754 m_editPoints->Point( RECT_BOT_RIGHT ).SetPosition( shape->GetBotRight() );
1755 m_editPoints->Point( RECT_BOT_LEFT ).SetPosition( shape->GetTopLeft().x,
1756 shape->GetBotRight().y );
1757 break;
1758
1759 case SHAPE_T::ARC:
1760 m_editPoints->Point( ARC_CENTER ).SetPosition( shape->GetCenter() );
1761 m_editPoints->Point( ARC_START ).SetPosition( shape->GetStart() );
1762 m_editPoints->Point( ARC_MID ).SetPosition( shape->GetArcMid() );
1763 m_editPoints->Point( ARC_END ).SetPosition( shape->GetEnd() );
1764 break;
1765
1766 case SHAPE_T::CIRCLE:
1767 m_editPoints->Point( CIRC_CENTER ).SetPosition( shape->GetCenter() );
1768 m_editPoints->Point( CIRC_END ).SetPosition( shape->GetEnd() );
1769 break;
1770
1771 case SHAPE_T::POLY:
1772 {
1773 std::vector<VECTOR2I> points;
1774 shape->DupPolyPointsList( points );
1775
1776 if( m_editPoints->PointsSize() != (unsigned) points.size() )
1777 {
1778 getView()->Remove( m_editPoints.get() );
1779 m_editedPoint = nullptr;
1780
1781 m_editPoints = makePoints( item );
1782
1783 if( m_editPoints )
1784 getView()->Add( m_editPoints.get() );
1785 }
1786 else
1787 {
1788 for( unsigned i = 0; i < points.size(); i++ )
1789 m_editPoints->Point( i ).SetPosition( points[i] );
1790 }
1791
1792 break;
1793 }
1794
1795 case SHAPE_T::BEZIER:
1796 m_editPoints->Point( BEZIER_CURVE_START ).SetPosition( shape->GetStart() );
1797 m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT1 ).SetPosition( shape->GetBezierC1() );
1798 m_editPoints->Point( BEZIER_CURVE_CONTROL_POINT2 ).SetPosition( shape->GetBezierC2() );
1799 m_editPoints->Point( BEZIER_CURVE_END ).SetPosition( shape->GetEnd() );
1800 break;
1801
1802 default: // suppress warnings
1803 break;
1804 }
1805
1806 break;
1807 }
1808
1809 case PCB_PAD_T:
1810 {
1811 const PAD* pad = static_cast<const PAD*>( item );
1812 bool locked = pad->GetParent() && pad->IsLocked();
1813 VECTOR2I shapePos = pad->ShapePos();
1814 VECTOR2I halfSize( pad->GetSize().x / 2, pad->GetSize().y / 2 );
1815
1816 switch( pad->GetShape() )
1817 {
1818 case PAD_SHAPE::CIRCLE:
1819 {
1820 int target = locked ? 0 : 1;
1821
1822 // Careful; pad shape is mutable...
1823 if( int( m_editPoints->PointsSize() ) != target )
1824 {
1825 getView()->Remove( m_editPoints.get() );
1826 m_editedPoint = nullptr;
1827
1828 m_editPoints = makePoints( item );
1829
1830 if( m_editPoints )
1831 getView()->Add( m_editPoints.get() );
1832 }
1833 else if( target == 1 )
1834 {
1835 shapePos.x += halfSize.x;
1836 m_editPoints->Point( 0 ).SetPosition( shapePos );
1837 }
1838 }
1839 break;
1840
1841 case PAD_SHAPE::OVAL:
1843 case PAD_SHAPE::RECT:
1846 {
1847 // Careful; pad shape and orientation are mutable...
1848 int target = locked || !pad->GetOrientation().IsCardinal() ? 0 : 4;
1849
1850 if( int( m_editPoints->PointsSize() ) != target )
1851 {
1852 getView()->Remove( m_editPoints.get() );
1853 m_editedPoint = nullptr;
1854
1855 m_editPoints = makePoints( item );
1856
1857 if( m_editPoints )
1858 getView()->Add( m_editPoints.get() );
1859 }
1860 else if( target == 4 )
1861 {
1862 if( pad->GetOrientation() == ANGLE_90 || pad->GetOrientation() == ANGLE_270 )
1863 std::swap( halfSize.x, halfSize.y );
1864
1865 m_editPoints->Point( RECT_TOP_LEFT ).SetPosition( shapePos - halfSize );
1867 .SetPosition(
1868 VECTOR2I( shapePos.x + halfSize.x, shapePos.y - halfSize.y ) );
1869 m_editPoints->Point( RECT_BOT_RIGHT ).SetPosition( shapePos + halfSize );
1870 m_editPoints->Point( RECT_BOT_LEFT )
1871 .SetPosition(
1872 VECTOR2I( shapePos.x - halfSize.x, shapePos.y + halfSize.y ) );
1873 }
1874
1875 break;
1876 }
1877
1878 default: // suppress warnings
1879 break;
1880 }
1881 }
1882 break;
1883
1884 case PCB_FP_ZONE_T:
1885 case PCB_ZONE_T:
1886 {
1887 ZONE* zone = static_cast<ZONE*>( item );
1888 const SHAPE_POLY_SET* outline = zone->Outline();
1889
1890 if( m_editPoints->PointsSize() != (unsigned) outline->TotalVertices() )
1891 {
1892 getView()->Remove( m_editPoints.get() );
1893 m_editedPoint = nullptr;
1894
1895 m_editPoints = makePoints( item );
1896
1897 if( m_editPoints )
1898 getView()->Add( m_editPoints.get() );
1899 }
1900 else
1901 {
1902 for( int i = 0; i < outline->TotalVertices(); ++i )
1903 m_editPoints->Point( i ).SetPosition( outline->CVertex( i ) );
1904 }
1905
1906 break;
1907 }
1908
1909 case PCB_DIM_ALIGNED_T:
1913 {
1914 const PCB_DIM_ALIGNED* dimension = static_cast<const PCB_DIM_ALIGNED*>( item );
1915
1916 m_editPoints->Point( DIM_START ).SetPosition( dimension->GetStart() );
1917 m_editPoints->Point( DIM_END ).SetPosition( dimension->GetEnd() );
1918 m_editPoints->Point( DIM_TEXT ).SetPosition( dimension->GetTextPos() );
1919 m_editPoints->Point( DIM_CROSSBARSTART ).SetPosition( dimension->GetCrossbarStart() );
1920 m_editPoints->Point( DIM_CROSSBAREND ).SetPosition( dimension->GetCrossbarEnd() );
1921 break;
1922 }
1923
1924 case PCB_DIM_CENTER_T:
1926 {
1927 const PCB_DIM_CENTER* dimension = static_cast<const PCB_DIM_CENTER*>( item );
1928
1929 m_editPoints->Point( DIM_START ).SetPosition( dimension->GetStart() );
1930 m_editPoints->Point( DIM_END ).SetPosition( dimension->GetEnd() );
1931 break;
1932 }
1933
1934 case PCB_DIM_RADIAL_T:
1936 {
1937 const PCB_DIM_RADIAL* dimension = static_cast<const PCB_DIM_RADIAL*>( item );
1938
1939 m_editPoints->Point( DIM_START ).SetPosition( dimension->GetStart() );
1940 m_editPoints->Point( DIM_END ).SetPosition( dimension->GetEnd() );
1941 m_editPoints->Point( DIM_TEXT ).SetPosition( dimension->GetTextPos() );
1942 m_editPoints->Point( DIM_KNEE ).SetPosition( dimension->GetKnee() );
1943 break;
1944 }
1945
1946 case PCB_DIM_LEADER_T:
1948 {
1949 const PCB_DIM_LEADER* dimension = static_cast<const PCB_DIM_LEADER*>( item );
1950
1951 m_editPoints->Point( DIM_START ).SetPosition( dimension->GetStart() );
1952 m_editPoints->Point( DIM_END ).SetPosition( dimension->GetEnd() );
1953 m_editPoints->Point( DIM_TEXT ).SetPosition( dimension->GetTextPos() );
1954 break;
1955 }
1956
1957 default:
1958 break;
1959 }
1960
1961 getView()->Update( m_editPoints.get() );
1962}
void DupPolyPointsList(std::vector< VECTOR2I > &aBuffer) const
Duplicate the list of corners in a std::vector<VECTOR2I>
Definition: eda_shape.cpp:1225

References KIGFX::VIEW::Add(), ANGLE_270, ANGLE_90, ARC, ARC_CENTER, ARC_END, ARC_START, BEZIER, BEZIER_CURVE_CONTROL_POINT1, BEZIER_CURVE_CONTROL_POINT2, BEZIER_CURVE_END, BEZIER_CURVE_START, CHAMFERED_RECT, CIRC_CENTER, CIRC_END, CIRCLE, SHAPE_POLY_SET::CVertex(), DIM_CROSSBAREND, DIM_CROSSBARSTART, DIM_END, DIM_KNEE, DIM_START, DIM_TEXT, EDA_SHAPE::DupPolyPointsList(), EDA_SHAPE::GetArcMid(), EDA_SHAPE::GetBezierC1(), EDA_SHAPE::GetBezierC2(), EDA_SHAPE::GetBotRight(), PCB_SHAPE::GetCenter(), PCB_DIM_ALIGNED::GetCrossbarEnd(), PCB_DIM_ALIGNED::GetCrossbarStart(), EDA_SHAPE::GetEnd(), PCB_DIMENSION_BASE::GetEnd(), PCB_DIM_RADIAL::GetKnee(), PCB_BITMAP::GetPosition(), EDA_SHAPE::GetShape(), PCB_BITMAP::GetSize(), EDA_SHAPE::GetStart(), PCB_DIMENSION_BASE::GetStart(), EDA_TEXT::GetTextPos(), EDA_SHAPE::GetTopLeft(), TOOL_BASE::getView(), locked, m_editedPoint, m_editPoints, makePoints(), ZONE::Outline(), OVAL, pad, PCB_BITMAP_T, PCB_DIM_ALIGNED_T, PCB_DIM_CENTER_T, PCB_DIM_LEADER_T, PCB_DIM_ORTHOGONAL_T, PCB_DIM_RADIAL_T, PCB_FP_DIM_ALIGNED_T, PCB_FP_DIM_CENTER_T, PCB_FP_DIM_LEADER_T, PCB_FP_DIM_ORTHOGONAL_T, PCB_FP_DIM_RADIAL_T, PCB_FP_SHAPE_T, PCB_FP_TEXTBOX_T, PCB_FP_ZONE_T, PCB_PAD_T, PCB_SHAPE_T, PCB_TEXTBOX_T, PCB_ZONE_T, POLY, RECT, RECT_BOT_LEFT, RECT_BOT_RIGHT, RECT_TOP_LEFT, RECT_TOP_RIGHT, KIGFX::VIEW::Remove(), ROUNDRECT, SEG_END, SEG_START, SEGMENT, SHAPE_POLY_SET::TotalVertices(), TRAPEZOID, EDA_ITEM::Type(), KIGFX::VIEW::Update(), VECTOR2< T >::x, and VECTOR2< T >::y.

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

◆ validatePolygon()

bool PCB_POINT_EDITOR::validatePolygon ( SHAPE_POLY_SET aModified) const
private

Validate a polygon and displays a popup warning if invalid.

Parameters
aModifiedis the polygon to be checked.
Returns
True if polygon is valid. Update edit points with item's points.

Definition at line 1669 of file pcb_point_editor.cpp.

1670{
1671 return true;
1672}

Referenced by removeCorner(), and updateItem().

◆ view()

◆ Wait()

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

Suspend 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_EVENT * ScheduleWait(TOOL_BASE *aTool, const TOOL_EVENT_LIST &aConditions)
Pause execution of a given tool until one or more events matching aConditions arrives.

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

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SELECTION_TOOL::doSelectionMenu(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), EDA_3D_CONTROLLER::Main(), CVPCB_CONTROL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), EE_POINT_EDITOR::Main(), EE_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ZOOM_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_POINT_EDITOR::Main(), PL_SELECTION_TOOL::Main(), PCB_PICKER_TOOL::Main(), PCB_SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), EE_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

Member Data Documentation

◆ COORDS_PADDING

const unsigned int PCB_POINT_EDITOR::COORDS_PADDING = pcbIUScale.mmToIU( 20 )
staticprivate

Definition at line 190 of file pcb_point_editor.h.

Referenced by OnSelectionChange().

◆ m_altConstrainer

EDIT_POINT PCB_POINT_EDITOR::m_altConstrainer
private

Definition at line 188 of file pcb_point_editor.h.

Referenced by setAltConstraint().

◆ m_altConstraint

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

Definition at line 187 of file pcb_point_editor.h.

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

◆ m_arcEditMode

ARC_EDIT_MODE PCB_POINT_EDITOR::m_arcEditMode
private

Definition at line 184 of file pcb_point_editor.h.

Referenced by changeArcEditMode(), OnSelectionChange(), and updateItem().

◆ m_editedPoint

◆ m_editPoints

◆ m_hoveredPoint

EDIT_POINT* PCB_POINT_EDITOR::m_hoveredPoint
private

Definition at line 178 of file pcb_point_editor.h.

Referenced by OnSelectionChange(), and updateEditedPoint().

◆ m_isBoardEditor

bool PCB_TOOL_BASE::m_isBoardEditor
protectedinherited

◆ m_isFootprintEditor

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

The functions below are not yet implemented - their interface may change.

Definition at line 125 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(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), EDA_3D_CONTROLLER::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< T >::Init(), SCH_DRAWING_TOOLS::Init(), SCH_EDIT_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), SYMBOL_EDITOR_CONTROL::Init(), SYMBOL_EDITOR_DRAWING_TOOLS::Init(), GERBVIEW_SELECTION_TOOL::Init(), PICKER_TOOL::Init(), ZOOM_TOOL::Init(), PL_DRAWING_TOOLS::Init(), PL_EDIT_TOOL::Init(), PL_SELECTION_TOOL::Init(), LENGTH_TUNER_TOOL::Init(), ROUTER_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), DRAWING_TOOL::Init(), FOOTPRINT_EDITOR_CONTROL::Init(), PAD_TOOL::Init(), PCB_SELECTION_TOOL::Init(), PCB_TOOL_BASE::Init(), PCB_VIEWER_TOOLS::Init(), DRAWING_TOOL::InteractivePlaceWithPreview(), EDA_3D_CONTROLLER::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ZOOM_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_SELECTION_TOOL::Main(), PCB_PICKER_TOOL::Main(), PCB_SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace().

◆ m_original

EDIT_POINT PCB_POINT_EDITOR::m_original
private

Original position for the current drag point.

Definition at line 180 of file pcb_point_editor.h.

Referenced by get45DegConstrainer(), and OnSelectionChange().

◆ m_refill

bool PCB_POINT_EDITOR::m_refill
private

Definition at line 182 of file pcb_point_editor.h.

Referenced by OnSelectionChange(), and Reset().

◆ m_selectionTool

PCB_SELECTION_TOOL* PCB_POINT_EDITOR::m_selectionTool
private

Definition at line 173 of file pcb_point_editor.h.

Referenced by Init(), and OnSelectionChange().

◆ m_statusPopup

std::unique_ptr<STATUS_TEXT_POPUP> PCB_POINT_EDITOR::m_statusPopup
mutableprivate

Definition at line 174 of file pcb_point_editor.h.

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

Name of the tool.

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

Definition at line 210 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 215 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), SELECTION_TOOL::AddItemsToSel(), SELECTION_TOOL::AddItemToSel(), SCH_MOVE_TOOL::AlignElements(), SCH_EDITOR_CONTROL::AssignNetclass(), BOARD_EDITOR_CONTROL::AssignNetclass(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), SCH_EDIT_TOOL::AutoplaceFields(), EE_SELECTION_TOOL::autostartEvent(), SCH_EDIT_TOOL::BreakWire(), BOARD_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDITOR_CONTROL::ChangeLineMode(), SCH_EDIT_TOOL::ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), GERBVIEW_CONTROL::ClearAllLayers(), SCH_EDITOR_CONTROL::ClearHighlight(), BOARD_INSPECTION_TOOL::ClearHighlight(), GERBVIEW_SELECTION_TOOL::clearSelection(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), PCB_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), PL_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), EDIT_TOOL::CreateArray(), MICROWAVE_TOOL::createInductorBetween(), EE_INSPECTION_TOOL::CrossProbe(), DRC_TOOL::CrossProbe(), COMMON_TOOLS::CursorControl(), SCH_EDITOR_CONTROL::Cut(), SCH_EDIT_TOOL::DeleteItemCursor(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), EDIT_TOOL::DeleteItems(), SCH_EDITOR_CONTROL::doCopy(), BOARD_EDITOR_CONTROL::doCrossProbePcbToSch(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), SCH_EDIT_TOOL::DoDelete(), SYMBOL_EDITOR_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), BOARD_INSPECTION_TOOL::doHideRatsnestNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PCB_SELECTION_TOOL::doSyncSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::Drag(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawRectangle(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), PAD_TOOL::EditPad(), SYMBOL_EDITOR_EDIT_TOOL::editShapeProperties(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), PCB_SELECTION_TOOL::EnterGroup(), GROUP_TOOL::EnterGroup(), SCH_NAVIGATE_TOOL::EnterSheet(), PAD_TOOL::EnumeratePads(), EE_INSPECTION_TOOL::ExcludeMarker(), PCB_SELECTION_TOOL::ExitGroup(), PCB_SELECTION_TOOL::expandConnection(), PAD_TOOL::explodePad(), PCB_SELECTION_TOOL::filterSelection(), PCB_SELECTION_TOOL::FindItem(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), EDIT_TOOL::Flip(), EDIT_TOOL::GetAndPlace(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getToolHolderInt(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), PCB_SELECTION_TOOL::grabUnconnected(), COMMON_TOOLS::GridNext(), COMMON_TOOLS::GridPreset(), COMMON_TOOLS::GridPrev(), PCB_CONTROL::GridSetOrigin(), GROUP_TOOL::Group(), GERBVIEW_CONTROL::HighlightControl(), BOARD_INSPECTION_TOOL::HighlightItem(), SCH_EDITOR_CONTROL::HighlightNet(), BOARD_INSPECTION_TOOL::HighlightNet(), BOARD_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PL_EDIT_TOOL::ImportDrawingSheetContent(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), EE_TOOL_BASE< T >::Init(), SCH_EDIT_TOOL::Init(), SYMBOL_EDITOR_CONTROL::Init(), SYMBOL_EDITOR_EDIT_TOOL::Init(), PL_DRAWING_TOOLS::Init(), PL_EDIT_TOOL::Init(), PL_POINT_EDITOR::Init(), ROUTER_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), BOARD_INSPECTION_TOOL::Init(), BOARD_REANNOTATE_TOOL::Init(), CONVERT_TOOL::Init(), DRAWING_TOOL::Init(), EDIT_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(), GROUP_TOOL::Init(), PAD_TOOL::Init(), Init(), PCB_SELECTION_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), POSITION_RELATIVE_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectConstraints(), DRAWING_TOOL::InteractivePlaceWithPreview(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isRouterActive(), TOOL_BASE::IsToolActive(), GROUP_TOOL::LeaveGroup(), BOARD_INSPECTION_TOOL::LocalRatsnestTool(), EDA_3D_CONTROLLER::Main(), CVPCB_CONTROL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_EDIT_TOOL::Main(), PL_SELECTION_TOOL::Main(), PCB_PICKER_TOOL::Main(), PCB_SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), SCH_EDIT_TOOL::Mirror(), SYMBOL_EDITOR_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), BOARD_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), SCH_EDITOR_CONTROL::NextLineMode(), SYMBOL_EDITOR_CONTROL::OnDeMorgan(), SELECTION_TOOL::onDisambiguationExpire(), COMMON_TOOLS::OnGridChanged(), OnSelectionChange(), SCH_EDITOR_CONTROL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_EDIT_TOOL::PinTable(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), GERBVIEW_CONTROL::Print(), PCB_CONTROL::Print(), SCH_EDIT_TOOL::Properties(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EDIT_TOOL::rebuildConnectivity(), ZONE_FILLER_TOOL::rebuildConnectivity(), EE_SELECTION_TOOL::RebuildSelection(), PAD_TOOL::RecombinePad(), SCH_EDITOR_CONTROL::Redo(), SYMBOL_EDITOR_EDIT_TOOL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), removeCorner(), GROUP_TOOL::RemoveFromGroup(), SELECTION_TOOL::RemoveItemFromSel(), SELECTION_TOOL::RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem(), PCB_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), EDA_3D_CONTROLLER::Reset(), COMMON_TOOLS::Reset(), PNS::TOOL_BASE::Reset(), PAD_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), TOOL_INTERACTIVE::resetTransitions(), SCH_EDITOR_CONTROL::Revert(), SCH_EDIT_TOOL::Rotate(), SYMBOL_EDITOR_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), ROUTER_TOOL::RouteSelected(), TOOL_INTERACTIVE::RunMainStack(), DRC_TOOL::RunTests(), EE_SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::SelectAll(), PCB_SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::SelectConnection(), PCB_TOOL_BASE::selection(), COMMON_TOOLS::SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), EE_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectNet(), GERBVIEW_SELECTION_TOOL::selectPoint(), PL_SELECTION_TOOL::SelectPoint(), PCB_SELECTION_TOOL::selectPoint(), EE_SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), PCB_SELECTION_TOOL::selectSameSheet(), PCB_SELECTION_TOOL::selectSheetContents(), DRAWING_TOOL::SetAnchor(), TOOL_INTERACTIVE::SetContextMenu(), EDA_3D_CONTROLLER::SetMaterial(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_EDIT_TOOL::Swap(), EE_SELECTION_TOOL::SyncSelection(), COMMON_TOOLS::ToggleCursor(), COMMON_TOOLS::ToggleCursorStyle(), EDA_3D_CONTROLLER::ToggleVisibility(), BOARD_EDITOR_CONTROL::TrackWidthDec(), BOARD_EDITOR_CONTROL::TrackWidthInc(), SCH_MOVE_TOOL::trimDanglingLines(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_EDITOR_CONTROL::Undo(), SYMBOL_EDITOR_EDIT_TOOL::Undo(), GROUP_TOOL::Ungroup(), PCB_SELECTION_TOOL::unrouteSelected(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), PNS::TOOL_BASE::updateEndItem(), BOARD_INSPECTION_TOOL::UpdateLocalRatsnest(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCB_CONTROL::UpdateMessagePanel(), EDIT_TOOL::updateModificationPoint(), EE_POINT_EDITOR::updateParentItem(), PNS::TOOL_BASE::updateStartItem(), BOARD_EDITOR_CONTROL::ViaSizeDec(), BOARD_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), BOARD_EDITOR_CONTROL::ZoneDuplicate(), and BOARD_EDITOR_CONTROL::ZoneMerge().

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Definition at line 214 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

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

Definition at line 207 of file tool_base.h.

Referenced by TOOL_BASE::GetType().


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