102 _(
"Specify custom track and via sizes" ), wxITEM_CHECK );
111 if(
via.m_Drill > 0 )
113 msg.Printf(
_(
"Via %s, drill %s" ),
123 Append( menuIdx, msg, wxEmptyString, wxITEM_CHECK );
132 int id = aEvent.GetId();
141 if( sizeDlg.ShowModal() == wxID_OK )
162 m_controls( nullptr ),
166 m_inDrawingTool( false ),
179 auto activeToolFunctor = [
this](
const SELECTION& aSel )
185 auto canUndoPoint = [
this](
const SELECTION& aSel )
194 auto canCloseOutline = [
this](
const SELECTION& aSel )
201 auto viaToolActive = [
this](
const SELECTION& aSel )
210 ctxMenu.AddSeparator( 1 );
217 ctxMenu.AddSeparator( 500 );
219 std::shared_ptr<VIA_SIZE_MENU> viaSizeMenu = std::make_shared<VIA_SIZE_MENU>();
220 viaSizeMenu->SetTool(
this );
222 ctxMenu.AddMenu( viaSizeMenu.get(), viaToolActive, 500 );
224 ctxMenu.AddSeparator( 500 );
230 getEditFrame<PCB_BASE_FRAME>()->AddStandardSubMenus(
m_menu );
242 m_frame = getEditFrame<PCB_BASE_EDIT_FRAME>();
266 constrained ?
_(
"Constrain to H, V, 45" ) : wxString(
"" ) );
302 static_cast<FP_SHAPE*>( line )->SetLocalCoord();
305 commit.
Push(
_(
"Draw a line segment" ) );
306 startingPoint =
VECTOR2D( line->GetEnd() );
339 rect->SetFilled(
false );
354 static_cast<FP_SHAPE*>( rect )->SetLocalCoord();
357 commit.
Push(
_(
"Draw a rectangle" ) );
364 rect->SetFilled(
false );
390 circle->SetFilled(
false );
391 circle->SetFlags(
IS_NEW );
400 while(
drawSegment( tool, &circle, startingPoint ) )
405 static_cast<FP_SHAPE*>( circle )->SetLocalCoord();
407 commit.
Add( circle );
408 commit.
Push(
_(
"Draw a circle" ) );
415 circle->SetFilled(
false );
416 circle->SetFlags(
IS_NEW );
447 while(
drawArc( tool, &arc, immediateMode ) )
452 static_cast<FP_SHAPE*>( arc )->SetLocalCoord();
455 commit.
Push(
_(
"Draw an arc" ) );
463 immediateMode =
false;
530 if( evt->IsCancelInteractive() )
542 else if( evt->IsActivate() )
547 if( evt->IsMoveTool() )
564 bool placing =
text !=
nullptr;
592 cancelled = !textDialog.ShowModal();
600 else if( fpText->
GetTextPos() != (wxPoint) cursorPos )
658 commit.
Push(
_(
"Place a text" ) );
678 else if(
text && evt->IsMotion() )
680 text->SetPosition( (wxPoint) cursorPos );
746 int step = SET_ORIGIN;
790 if( step > SET_ORIGIN )
796 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
800 cursorPos =
grid.BestSnapAnchor( cursorPos,
nullptr );
803 if( evt->IsCancelInteractive() )
807 if( step != SET_ORIGIN )
817 else if( evt->IsActivate() )
819 if( step != SET_ORIGIN )
822 if( evt->IsPointEditor() )
826 else if( evt->IsMoveTool() )
869 auto setMeasurementAttributes =
872 aDim->SetUnitsMode( boardSettings.m_DimensionUnitsMode );
873 aDim->SetUnitsFormat( boardSettings.m_DimensionUnitsFormat );
874 aDim->SetPrecision( boardSettings.m_DimensionPrecision );
875 aDim->SetSuppressZeroes( boardSettings.m_DimensionSuppressZeroes );
876 aDim->SetTextPositionMode( boardSettings.m_DimensionTextPosition );
877 aDim->SetKeepTextAligned( boardSettings.m_DimensionKeepTextAligned );
886 setMeasurementAttributes( dimension );
891 setMeasurementAttributes( dimension );
904 wxFAIL_MSG( wxT(
"Unhandled action in DRAWING_TOOL::DrawDimension" ) );
910 dimension->
Text().
SetItalic( boardSettings.GetTextItalic( layer ) );
912 dimension->
SetArrowLength( boardSettings.m_DimensionArrowLength );
914 dimension->
SetStart( (wxPoint) cursorPos );
915 dimension->
SetEnd( (wxPoint) cursorPos );
924 preview.
Add( dimension );
934 dimension->
SetEnd( (wxPoint) cursorPos );
944 dimension->
SetText( wxT(
"?" ) );
964 preview.
Remove( dimension );
966 commit.
Add( dimension );
967 commit.
Push(
_(
"Draw a leader" ) );
972 else if( (wxPoint) cursorPos != dimension->
GetPosition() )
977 preview.
Remove( dimension );
979 commit.
Add( dimension );
980 commit.
Push(
_(
"Draw a dimension" ) );
988 if( ++step == FINISHED )
995 else if( evt->IsMotion() )
1000 dimension->
SetEnd( (wxPoint) cursorPos );
1010 bool vert = bounds.
GetWidth() < bounds.GetHeight();
1027 PCB_DIM_ALIGNED* aligned = static_cast<PCB_DIM_ALIGNED*>( dimension );
1032 wxPoint
delta( (wxPoint) cursorPos - dimension->
GetEnd() );
1043 VECTOR2I direction( cursorPos - bounds.Centre() );
1047 if( !bounds.Contains( cursorPos ) )
1051 if( bounds.GetWidth() == 0 )
1055 else if( bounds.GetHeight() == 0 )
1059 else if( cursorPos.x > bounds.GetLeft() && cursorPos.x < bounds.GetRight() )
1063 else if( cursorPos.y > bounds.GetTop() && cursorPos.y < bounds.GetBottom() )
1069 vert = std::abs( direction.y ) < std::abs( direction.x );
1080 ortho->SetHeight( vert ? heightVector.x : heightVector.y );
1113 dimension->
Text().
SetItalic( boardSettings.GetTextItalic( layer ) );
1122 evt->SetPassEvent();
1127 if( step == SET_END || step == SET_HEIGHT )
1136 evt->SetPassEvent();
1141 evt->SetPassEvent();
1145 if( step != SET_ORIGIN )
1173 int dlgResult = dlg.ShowModal();
1177 if( dlgResult != wxID_OK )
1183 wxMessageBox(
_(
"No graphic items found in file.") );
1189 std::vector<BOARD_ITEM*> newItems;
1190 std::vector<BOARD_ITEM*> selectedItems;
1202 newItems.push_back(
group );
1203 selectedItems.push_back(
group );
1207 for( std::unique_ptr<EDA_ITEM>& ptr : list )
1209 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( ptr.get() );
1216 newItems.push_back( item );
1219 group->AddItem( item );
1221 selectedItems.push_back( item );
1223 preview.
Add( item );
1233 commit.
Push(
_(
"Place a DXF_SVG drawing" ) );
1263 VECTOR2I delta = cursorPos - static_cast<BOARD_ITEM*>( preview.
Front() )->GetPosition();
1266 item->Move( (wxPoint)
delta );
1276 if( evt->IsCancelInteractive() || evt->IsActivate() )
1285 else if( evt->IsMotion() )
1287 delta = cursorPos - static_cast<BOARD_ITEM*>( preview.
Front() )->GetPosition();
1290 item->Move( (wxPoint)
delta );
1304 commit.
Push(
_(
"Place a DXF_SVG drawing" ) );
1309 evt->SetPassEvent();
1363 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
1378 commit.
Push(
_(
"Move the footprint reference anchor" ) );
1389 else if( evt->IsCancelInteractive() || evt->IsActivate() )
1396 evt->SetPassEvent();
1436 SHAPE_T shape = ( *aGraphic )->GetShape();
1461 bool started =
false;
1462 bool cancelled =
false;
1480 if( !isLocalOriginSet )
1491 if( aStartingPoint )
1503 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
1507 if( evt->IsCancelInteractive() )
1514 evt->SetPassEvent(
false );
1521 else if( evt->IsActivate() )
1523 if( evt->IsPointEditor() )
1527 else if( evt->IsMoveTool() )
1555 graphic->SetLayer( drawingLayer );
1562 evt->SetPassEvent();
1576 evt->SetPassEvent();
1589 if( aStartingPoint )
1591 cursorPos = aStartingPoint.get();
1598 graphic->SetShape( static_cast<SHAPE_T>( shape ) );
1599 graphic->SetFilled(
false );
1601 graphic->SetLayer( drawingLayer );
1602 grid.SetSkipPoint( cursorPos );
1604 twoPointManager.
SetOrigin( (wxPoint) cursorPos );
1605 twoPointManager.
SetEnd( (wxPoint) cursorPos );
1607 if( !isLocalOriginSet )
1610 preview.
Add( graphic );
1629 twoPointManager.
Reset();
1634 PCB_SHAPE* snapItem = dyn_cast<PCB_SHAPE*>(
grid.GetSnapped() );
1646 if( snapItem && ( shape ==
SHAPE_T::RECT || graphic->GetLength() > 0.0 ) )
1648 commit.
Add( graphic );
1649 commit.
Push(
_(
"Draw a line segment" ) );
1661 twoPointManager.
Reset();
1665 twoPointManager.
SetEnd( cursorPos );
1667 else if( evt->IsMotion() )
1677 twoPointManager.
SetEnd( twoPointManager.
GetOrigin() + (wxPoint) newEnd );
1682 twoPointManager.
SetEnd( (wxPoint) cursorPos );
1706 isLocalOriginSet =
true;
1707 evt->SetPassEvent();
1714 twoPointAsst.
SetUnits( userUnits );
1717 evt->SetPassEvent();
1721 evt->SetPassEvent();
1725 if( !isLocalOriginSet )
1754 aArc.
SetEnd( (wxPoint) vec );
1762 wxCHECK( graphic, 0 );
1791 *aGraphic =
nullptr;
1798 bool firstPoint =
false;
1799 bool cancelled =
false;
1804 if( aImmediateMode )
1818 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
1822 if( evt->IsCancelInteractive() )
1829 evt->SetPassEvent(
false );
1836 else if( evt->IsActivate() )
1838 if( evt->IsPointEditor() )
1842 else if( evt->IsMoveTool() )
1857 else if( evt->IsClick(
BUT_LEFT ) )
1880 preview.Add( graphic );
1885 arcManager.
AddPoint( cursorPos,
true );
1891 else if( evt->IsMotion() )
1897 arcManager.
AddPoint( cursorPos,
false );
1919 evt->SetPassEvent();
1943 evt->SetPassEvent();
1972 evt->SetPassEvent();
1976 evt->SetPassEvent();
1996 preview.Remove( graphic );
2012 bool clearSelection =
false;
2024 clearSelection =
true;
2030 *aZone = dyn_cast<ZONE*>(
selection[0] );
2035 if( clearSelection )
2063 ZONE* sourceZone =
nullptr;
2074 params.
m_mode = zoneMode;
2086 bool constrainAngle =
false;
2087 bool started =
false;
2091 status.SetTextColor( wxColour( 255, 0, 0 ) );
2092 status.SetText(
_(
"Self-intersecting polygons are not allowed" ) );
2106 polyGeomMgr.
Reset();
2108 grid.ClearSkipPoint();
2130 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
2133 cursorPos =
grid.BestSnapAnchor( cursorPos, layers );
2142 if( evt->IsCancelInteractive() )
2151 evt->SetPassEvent(
false );
2156 else if( evt->IsActivate() )
2161 if( evt->IsPointEditor() )
2165 else if( evt->IsMoveTool() )
2197 const bool endPolygon = evt->IsDblClick(
BUT_LEFT )
2204 polyGeomMgr.
Reset();
2211 else if( polyGeomMgr.
AddPoint( cursorPos ) )
2247 && ( evt->IsMotion() || evt->IsDrag(
BUT_LEFT ) ) )
2253 wxPoint p = wxGetMousePosition() + wxPoint( 20, 20 );
2255 status.PopupFor( 1500 );
2272 evt->SetPassEvent();
2285 evt->SetPassEvent();
2307 std::shared_ptr<DRC_ENGINE> m_drcEngine;
2309 int m_worstClearance;
2310 bool m_allowDRCViolations;
2317 m_worstClearance( 0 )
2333 m_worstClearance = std::max( m_worstClearance, constraint.
GetValue().
Min() );
2338 m_worstClearance = std::max( m_worstClearance,
pad->GetLocalClearance() );
2346 virtual ~VIA_PLACER()
2356 std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> items;
2358 std::vector<PCB_TRACK*> possible_tracks;
2362 for(
auto it : items )
2364 BOARD_ITEM* item = static_cast<BOARD_ITEM*>( it.first );
2369 if(
PCB_TRACK* track = dyn_cast<PCB_TRACK*>( item ) )
2371 if(
TestSegmentHit( position, track->GetStart(), track->GetEnd(),
2372 ( track->GetWidth() + aVia->
GetWidth() ) / 2 ) )
2373 possible_tracks.push_back( track );
2378 int min_d = std::numeric_limits<int>::max();
2380 for(
PCB_TRACK* track : possible_tracks )
2382 SEG test( track->GetStart(), track->GetEnd() );
2388 return_track = track;
2392 return return_track;
2405 && static_cast<ZONE*>( aOther )->GetIsRuleArea() )
2407 ZONE* zone = static_cast<ZONE*>( aOther );
2436 if( clearance >= 0 )
2441 if( viaShape->Collide( otherShape.get(), clearance - m_drcEpsilon ) )
2446 std::unique_ptr<SHAPE_SEGMENT> holeShape;
2450 PCB_VIA*
via = static_cast<PCB_VIA*>( aOther );
2451 wxPoint pos =
via->GetPosition();
2457 PAD*
pad = static_cast<PAD*>( aOther );
2459 if(
pad->GetDrillSize().x )
2469 if( clearance >= 0 )
2473 if( viaShape->Collide( holeShape.get(), clearance - m_drcEpsilon ) )
2481 bool checkDRCViolation(
PCB_VIA* aVia )
2483 std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> items;
2484 std::set<BOARD_ITEM*> checkedItems;
2487 bbox.
Inflate( m_worstClearance );
2490 for( std::pair<KIGFX::VIEW_ITEM*, int> it : items )
2492 BOARD_ITEM* item = dynamic_cast<BOARD_ITEM*>( it.first );
2498 && !static_cast<ZONE*>( item )->GetIsRuleArea() )
2507 && !static_cast<FP_TEXT*>( item )->IsVisible() )
2511 else if( checkedItems.count( item ) )
2516 if( hasDRCViolation( aVia, item ) )
2519 checkedItems.insert( item );
2532 for(
PAD*
pad : fp->Pads() )
2534 if(
pad->HitTest( position ) && (
pad->GetLayerSet() & lset ).any() )
2535 if(
pad->GetNetCode() > 0 )
2543 int findStitchedZoneNet(
PCB_VIA* aVia )
2556 return z->GetNetCode();
2568 if( z->HitTestFilledArea( layer, position ) )
2569 return z->GetNetCode();
2586 PCB_VIA*
via = static_cast<PCB_VIA*>( aItem );
2587 wxPoint position =
via->GetPosition();
2609 PCB_VIA*
via = static_cast<PCB_VIA*>( aItem );
2610 wxPoint viaPos =
via->GetPosition();
2617 via->SetNetCode(
pad->GetNetCode() );
2619 via->SetNetCode( findStitchedZoneNet(
via ) );
2621 if( !m_allowDRCViolations && checkDRCViolation(
via ) )
2625 via->SetNetCode( 0 );
2640 PCB_TRACK* newTrack = dynamic_cast<PCB_TRACK*>( track->
Clone() );
2641 const_cast<KIID&>( newTrack->
m_Uuid ) =
KIID();
2645 aCommit.
Add( newTrack );
2650 via->SetNetCode( findStitchedZoneNet(
via ) );
2654 aCommit.
Add( aItem );
2658 std::unique_ptr<BOARD_ITEM> CreateItem()
override 2663 via->SetNetCode( 0 );
2684 switch(
via->GetViaType() )
2687 via->SetLayerPair( first_layer, last_layer );
2695 if( first_layer ==
B_Cu )
2696 last_layer = last_inner_layer;
2697 else if( first_layer ==
F_Cu )
2699 else if( first_layer == last_inner_layer )
2701 else if( first_layer ==
In1_Cu )
2705 via->SetLayerPair( first_layer, last_layer );
2719 return std::unique_ptr<BOARD_ITEM>(
via );
2723 VIA_PLACER placer(
frame() );
void SetMirrored(bool isMirrored)
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
static TOOL_ACTION selectItems
Select a list of items (specified as the event parameter)
static TOOL_ACTION selectionClear
Clear the current selection.
void DisplayConstraintsMsg(const wxString &msg)
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
double GetAngle() const
Return the angle of the crossbar.
static TOOL_ACTION drawLine
static TOOL_ACTION drawCenterDimension
Container to handle a stock of specific vias each with unique diameter and drill sizes in the BOARD c...
wxString MessageTextFromValue(EDA_UNITS aUnits, int aValue, bool aAddUnitLabel, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Manage the construction of a circular arc though sequential setting of critical points: center,...
void SetObjectVisible(GAL_LAYER_ID aLayer, bool aVisible=true)
COMMIT & Modify(EDA_ITEM *aItem)
Create an undo entry for an item that has been already modified.
VECTOR2< T > GetVectorSnapped45(const VECTOR2< T > &aVec, bool only45=false)
Snap a vector onto the nearest 0, 45 or 90 degree line.
static TOOL_ACTION placeImportedGraphics
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
virtual void Clear() override
Remove all the stored items from the group.
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
class PCB_DIM_LEADER, a leader dimension (graphic item)
VECTOR2I GetEndRadiusEnd() const
Get the radius of the arc (valid if step >= SET_START)
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
class FP_TEXT, text in a footprint
void SetHeight(int aHeight)
Set the distance from the feature points to the crossbar line.
Add a new zone with the same settings as an existing one.
virtual VECTOR2D GetMousePosition(bool aWorldCoordinates=true) const =0
Return the current mouse pointer position.
int GetCurrentViaDrill() const
LEADER_MODE
The kind of the leader line.
ZONE * m_sourceZone
Zone leader mode.
static TOOL_ACTION incWidth
Increase width of currently drawn line.
wxPoint GetPosition() const override
void SetEnd(const wxPoint &aEnd)
virtual void SetPosition(const wxPoint &aPos) override
wxString GetDesignRulesPath()
Return the absolute path to the design rules file for the currently-loaded board.
const wxPoint & GetEnd() const
int GetUserUnits()
Return the currently selected user unit value for the interface.
virtual EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
static TOOL_ACTION drawSimilarZone
#define IS_NEW
New item, just created.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
This file is part of the common library.
virtual void SetPosition(const wxPoint &aPos)
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual void Add(EDA_ITEM *aItem)
static TOOL_ACTION drawArc
class PCB_GROUP, a set of BOARD_ITEMs
static std::shared_ptr< SHAPE > GetShape(BOARD_ITEM *aItem, PCB_LAYER_ID aLayer)
void SetEnd(const wxPoint &aEnd)
COMMIT & Add(EDA_ITEM *aItem)
Notify observers that aItem has been added.
Represents an assistant draw when interactively drawing a line or circle on a canvas.
A set of BOARD_ITEMs (i.e., without duplicates).
class PCB_DIM_CENTER, a center point marking (graphic item)
Represent a very simple geometry manager for items that have a start and end point.
std::list< std::unique_ptr< EDA_ITEM > > & GetImportedItems()
bool GetDoNotAllowVias() const
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
Class that computes missing connections on a PCB.
void SetItalic(bool isItalic)
VECTOR2I GetOrigin() const
virtual void OnEditItemRequest(BOARD_ITEM *aItem)=0
Install the corresponding dialog editor for the given item.
static TOOL_ACTION drawAlignedDimension
static TOOL_ACTION cancelInteractive
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
void SetTextPos(const wxPoint &aPoint)
static TOOL_ACTION properties
Activation of the edit tool.
static TOOL_ACTION drawOrthogonalDimension
void SetText(const wxString &aNewText)
Set the override text - has no effect if m_overrideValue == false.
void SetFlags(EDA_ITEM_FLAGS aMask)
class PCB_TEXT, text on a layer
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
PCB_LAYER_ID m_layer
The zone mode to operate in.
static TOOL_ACTION drawPolygon
VECTOR2I GetStartRadiusEnd() const
Get the coordinates of the arc end point.
static TOOL_ACTION trackViaSizeChanged
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
void RemoveLastPoint()
Undo the last point, and move the manager back to the previous step.
void SetArcAngleAndEnd(double aAngle, bool aCheckNegativeAngle=false)
Set the end point from the angle center and start.
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false, long aArrowCommand=0)=0
Move cursor to the requested position expressed in world coordinates.
class FP_SHAPE, a footprint edge
class PAD, a pad in a footprint
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
void SetTextSize(const wxSize &aNewSize)
void Reset()
Reset the manager to the initial state.
virtual MAGNETIC_SETTINGS * GetMagneticItemsSettings()
Parameters used to fully describe a zone creation process.
bool NewPointClosesOutline(const VECTOR2I &aPt) const
int GetTextThickness(PCB_LAYER_ID aLayer) const
Return the default text thickness from the layer class for the given layer.
static bool IsNetTie(BOARD_ITEM *aItem)
VIATYPE m_CurrentViaType
(VIA_BLIND_BURIED, VIA_THROUGH, VIA_MICROVIA)
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
void SetLeaderMode(LEADER_MODE aMode)
Set the leader mode to use when calculating the leader/returner lines.
APPEARANCE_CONTROLS * GetAppearancePanel()
LEADER_MODE GetLeaderMode() const
void SetExtensionOffset(int aOffset)
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
bool AllowDRCViolations() const
static TOOL_ACTION setAnchor
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
An orthogonal dimension is like an aligned dimension, but the extension lines are locked to the X or ...
static TOOL_ACTION placeText
bool m_UseConnectedTrackWidth
bool HasGeometryChanged() const
void AddPoint(const VECTOR2I &aPt, bool aLockIn)
Add a point to the construction manager.
void ShowTextPropertiesDialog(BOARD_ITEM *aText)
Control for copper zone opacity/visibility (color ignored)
static TOOL_ACTION decWidth
Decrease width of currently drawn line.
This file contains miscellaneous commonly used macros and functions.
void SetLineThickness(int aWidth)
For better understanding of the points that make a dimension:
void SetAngleSnap(bool aSnap)
bool GetTextUpright(PCB_LAYER_ID aLayer) const
void SetStart(const wxPoint &aStart)
bool GetTextItalic(PCB_LAYER_ID aLayer) const
virtual PCB_LAYER_ID GetActiveLayer() const
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false, WX_INFOBAR::MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left o...
int GetLineThickness(PCB_LAYER_ID aLayer) const
Return the default graphic segment thickness from the layer class for the given layer.
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
void SetViaSizeIndex(unsigned aIndex)
Set the current via size list index to aIndex.
virtual const wxPoint & GetStart() const
The dimension's origin is the first feature point for the dimension.
void SetReferencePoint(const VECTOR2I &aP)
bool IsPlacementInteractive()
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
LSET is a set of PCB_LAYER_IDs.
RAII class that sets an value at construction and resets it to the original value at destruction.
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
VECTOR2< double > VECTOR2D
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
Waiting to lock in the arc start point.
MESSAGE_TYPE GetMessageType() const
unsigned GetViaSizeIndex() const
virtual void CaptureCursor(bool aEnabled)
Force the cursor to stay within the drawing panel area.
virtual void SetEnd(const wxPoint &aPoint)
virtual PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
coord_type GetWidth() const
VECTOR2I GetOrigin() const
< Get the center point of the arc (valid when state > SET_ORIGIN)
wxPoint GetPosition() const override
FOOTPRINTS & Footprints()
A collection of nets and the parameters used to route or test these nets.
bool TestSegmentHit(const wxPoint &aRefPoint, const wxPoint &aStart, const wxPoint &aEnd, int aDist)
Test if aRefPoint is with aDistance on the line defined by aStart and aEnd.
Mark the center of a circle or arc with a cross shape.
void SetOrigin(const VECTOR2I &aOrigin)
< Set the origin of the ruler (the fixed end)
bool m_PcbUse45DegreeLimit
void SetArrowLength(int aLength)
static TOOL_ACTION drawRectangle
void SetStart(const wxPoint &aStart)
PCB_LAYER_ID m_Route_Layer_BOTTOM
Add a new zone/keepout with fresh settings.
bool IsSelfIntersecting(bool aIncludeLeaderPts) const
Check whether the locked points constitute a self-intersecting outline.
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Place the cursor immediately at a given point.
void SetWidth(int aWidth)
a few functions useful in geometry calculations.
static LSET AllLayersMask()
bool IsPolygonInProgress() const
bool m_FpeditUse45DegreeLimit
static TOOL_ACTION drawVia
Handle a list of polygons defining a copper zone.
class ZONE, a copper pour area
int GetuViaDiameter() const
Unconstrained point-to-point.
void SetCenter(const wxPoint &aCenter)
static TOOL_ACTION drawZoneCutout
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
bool Empty() const
Checks if there is anything selected.
class FOOTPRINT, a footprint
void DeleteLastCorner()
Remove the last-added point from the polygon.
virtual BOARD_ITEM_CONTAINER * GetModel() const =0
static TOOL_ACTION placeCharacteristics
static TOOL_ACTION drawCircle
void SetKeepUpright(bool aKeepUpright)
A modified version of the wxInfoBar class that allows us to:
void OnGeometryChange(const POLYGON_GEOM_MANAGER &aMgr) override
Called when the polygon is complete.
int GetCurrentViaSize() const
static TOOL_ACTION arcPosture
Switch posture when drawing arc.
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
static TOOL_ACTION layerChanged
static TOOL_ACTION drawLeader
A filename or source description, a problem input line, a line number, a byte offset,...
static TOOL_ACTION updateUnits
static TOOL_ACTION drawRuleArea
int GetDRCEpsilon() const
Waiting to lock in the arc end point.
const MINOPTMAX< int > & GetValue() const
bool IsType(FRAME_T aType) const
Common, abstract interface for edit frames.
void ToggleClockwise()
Set angle snapping (for the next point)
PCB_LAYER_ID
A quick note on layer IDs:
ARC_STEPS GetStep() const
Get the current step the manager is on (useful when drawing something depends on the current state)
static TOOL_ACTION placeStackup
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
virtual void Remove(EDA_ITEM *aItem)
int GetCopperLayerCount() const
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
class ZONE, managed by a footprint
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
virtual void SetStart(const wxPoint &aPoint)
An adjunct helper to the DRAWING_TOOL interactive tool, which handles incoming geometry changes from ...
void SetShape(SHAPE_T aShape)
The main frame for Pcbnew.
PCBNEW_SETTINGS & Settings()
int Size() const
Returns the number of selected parts.
Represents an assistant draw when interactively drawing an arc on a canvas.
static TOOL_ACTION resetLocalCoords
void Reset()
Clear the manager state and start again.
virtual void Push(const wxString &aMessage=wxT("A commit"), bool aCreateUndoEntry=true, bool aSetDirtyBit=true) override
Revert the commit by restoring the modified items state.
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
std::vector< VIA_DIMENSION > m_ViasDimensionsList
static TOOL_ACTION deleteLastPoint
const wxPoint & GetTextPos() const
WX_INFOBAR * GetInfoBar()
A leader is a dimension-like object pointing to a specific point.
Implementing DIALOG_TRACK_VIA_SIZE_BASE.
void SetAngleSnap(bool aSnap)
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
class PCB_VIA, a via (like a track segment on a copper layer)
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
void SetLayerVisible(LAYER_NUM aLayer, bool isVisible)
virtual const wxPoint & GetEnd() const
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
virtual int Query(const BOX2I &aRect, std::vector< LAYER_ITEM_PAIR > &aResult) const
Find all visible items that touch or are within the rectangle aRect.
bool m_keepout
< Should create a keepout zone?
bool AddPoint(const VECTOR2I &aPt)
Lock in a polygon point.
void SetCursorPosition(const VECTOR2I &aPos)
Set the current cursor position.
class PCB_SHAPE, a segment not on copper layers
static constexpr int Millimeter2iu(double mm)
void SetFinished()
Mark the polygon finished and update the client.
static TOOL_ACTION toggle45
ROUTING_SETTINGS & Settings()
bool NoPrintableChars(const wxString &aString)
Return true if the string is empty or contains only whitespace.
virtual const wxString & GetText() const
Return the string associated with the text object.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
int GetLineThickness() const
wxSize GetTextSize(PCB_LAYER_ID aLayer) const
Return the default text size from the layer class for the given layer.
static TOOL_ACTION drawZone
VECTOR2I AlignToSegment(const VECTOR2I &aPoint, const SEG &aSeg)
Class that handles the drawing of a polygon, including management of last corner deletion and drawing...
std::shared_ptr< DRC_ENGINE > m_DRCEngine
static TOOL_ACTION selectionCursor
Select a single item under the cursor position.
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
void SetUnits(EDA_UNITS aUnits)
ZONE_MODE m_mode
Zone settings source (for similar and cutout zones)
PCB_LAYER_ID m_Route_Layer_TOP
const wxPoint & GetStart() const
static TOOL_ACTION refreshPreview
void UseCustomTrackViaSize(bool aEnabled)
Enables/disables custom track/via size settings.
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
static TOOL_ACTION cursorClick
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...
VECTOR2D m_LocalOrigin
Relative Screen cursor coordinate (on grid) in user units.
void SetEnd(const VECTOR2I &aEnd)
Set the current end of the rectangle (the end that moves with the cursor.
KICAD_T Type() const
Returns the type of object.
Container for design settings for a BOARD object.
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
static TOOL_ACTION closeOutline
void Update()
Update the dimension's cached text and geometry.