23#include <wx/filedlg.h>
24#include <wx/hyperlink.h>
32using namespace std::placeholders;
114 .Name(
"pcbnew.InteractiveRouter.PlaceVia" )
116 .DefaultHotkey(
'V' )
117 .LegacyHotkeyName(
"Add Through Via" )
118 .FriendlyName(
_(
"Place Through Via" ) )
119 .Tooltip(
_(
"Adds a through-hole via at the end of currently routed track." ) )
125 .Name(
"pcbnew.InteractiveRouter.PlaceBlindVia" )
128 .LegacyHotkeyName(
"Add Blind/Buried Via" )
129 .FriendlyName(
_(
"Place Blind/Buried Via" ) )
130 .Tooltip(
_(
"Adds a blind or buried via at the end of currently routed track.") )
136 .Name(
"pcbnew.InteractiveRouter.PlaceMicroVia" )
138 .DefaultHotkey(
MD_CTRL +
'V' )
139 .LegacyHotkeyName(
"Add MicroVia" )
140 .FriendlyName(
_(
"Place Microvia" ) )
141 .Tooltip(
_(
"Adds a microvia at the end of currently routed track." ) )
147 .Name(
"pcbnew.InteractiveRouter.SelLayerAndPlaceVia" )
149 .DefaultHotkey(
'<' )
150 .LegacyHotkeyName(
"Select Layer and Add Through Via" )
151 .FriendlyName(
_(
"Select Layer and Place Through Via..." ) )
152 .Tooltip(
_(
"Select a layer, then add a through-hole via at the end of currently routed track." ) )
158 .Name(
"pcbnew.InteractiveRouter.SelLayerAndPlaceBlindVia" )
160 .DefaultHotkey(
MD_ALT +
'<' )
161 .LegacyHotkeyName(
"Select Layer and Add Blind/Buried Via" )
162 .FriendlyName(
_(
"Select Layer and Place Blind/Buried Via..." ) )
163 .Tooltip(
_(
"Select a layer, then add a blind or buried via at the end of currently routed track." ) )
169 .Name(
"pcbnew.InteractiveRouter.SelLayerAndPlaceMicroVia" )
171 .FriendlyName(
_(
"Select Layer and Place Micro Via..." ) )
172 .Tooltip(
_(
"Select a layer, then add a micro via at the end of currently routed track." ) )
178 .Name(
"pcbnew.InteractiveRouter.CustomTrackViaSize" )
180 .DefaultHotkey(
'Q' )
181 .LegacyHotkeyName(
"Custom Track/Via Size" )
182 .FriendlyName(
_(
"Custom Track/Via Size..." ) )
183 .Tooltip(
_(
"Shows a dialog for changing the track width and via size." ) )
187 .Name(
"pcbnew.InteractiveRouter.SwitchPosture" )
189 .DefaultHotkey(
'/' )
190 .LegacyHotkeyName(
"Switch Track Posture" )
191 .FriendlyName(
_(
"Switch Track Posture" ) )
192 .Tooltip(
_(
"Switches posture of the currently routed track." ) )
196 .Name(
"pcbnew.InteractiveRouter.SwitchRounding" )
198 .DefaultHotkey(
MD_CTRL +
'/' )
199 .FriendlyName(
_(
"Track Corner Mode" ) )
200 .Tooltip(
_(
"Switches between sharp/rounded and 45°/90° corners when routing tracks." ) )
204#define _(s) wxGetTranslation((s))
211 m_inRouterTool( false )
223 SetIcon( BITMAPS::width_track_via );
224 SetTitle(
_(
"Select Track/Via Width" ) );
243 _(
"Route using the width of the starting track." ), wxITEM_CHECK );
248 _(
"Use track and via sizes from the net class" ), wxITEM_CHECK );
253 _(
"Specify custom track and via sizes" ), wxITEM_CHECK );
264 msg =
_(
"Track netclass width" );
269 Append( menuIdx, msg, wxEmptyString, wxITEM_CHECK );
280 msg =
_(
"Via netclass values" );
283 if(
via.m_Drill > 0 )
285 msg.Printf(
_(
"Via %s, hole %s" ),
291 msg.Printf(
_(
"Via %s" ),
297 Append( menuIdx, msg, wxEmptyString, wxITEM_CHECK );
305 int id = aEvent.GetId();
356 SetIcon( BITMAPS::width_track_via );
357 SetTitle(
_(
"Select Differential Pair Dimensions" ) );
373 _(
"Use differential pair dimensions from the net class" ), wxITEM_CHECK );
378 _(
"Specify custom differential pair dimensions" ), wxITEM_CHECK );
391 if( diffPair.
m_Gap <= 0 )
395 msg.Printf(
_(
"Width %s" ),
400 msg.Printf(
_(
"Width %s, via gap %s" ),
409 msg.Printf(
_(
"Width %s, gap %s" ),
415 msg.Printf(
_(
"Width %s, gap %s, via gap %s" ),
423 Append( menuIdx, msg, wxEmptyString, wxITEM_CHECK );
431 int id = aEvent.GetId();
475 auto& menu =
m_menu->GetMenu();
476 menu.SetTitle(
_(
"Interactive Router" ) );
494 auto notRoutingCond =
505 if( currentNets.empty() || currentNets[0] == nullptr )
514 return ratsnest && !ratsnest->
GetEdges().empty();
518 menu.AddSeparator( 1 );
521 menu.AddSeparator( haveHighlight, 2 );
578 static size_t lastLoggerSize = 0;
582 if( !logger || logger->GetEvents().size() == 0
583 || logger->GetEvents().size() == lastLoggerSize )
588 wxFileDialog dlg(
frame(),
_(
"Save router log" ), mruPath,
"pns.log",
590 wxFD_OVERWRITE_PROMPT | wxFD_SAVE );
592 if( dlg.ShowModal() != wxID_OK )
594 lastLoggerSize = logger->GetEvents().size();
598 wxFileName fname_log( dlg.GetPath() );
599 mruPath = fname_log.GetPath();
601 wxFileName fname_dump( fname_log );
602 fname_dump.SetExt(
"dump" );
604 wxFileName fname_settings( fname_log );
605 fname_settings.SetExt(
"settings" );
607 FILE* settings_f = wxFopen( fname_settings.GetAbsolutePath(),
"wb" );
609 fprintf( settings_f,
"%s\n", settingsStr.c_str() );
610 fclose( settings_f );
624 std::vector<PNS::ITEM*> added, removed, heads;
627 std::set<KIID> removedKIIDs;
629 for(
auto item : removed )
631 wxASSERT_MSG( item->Parent() !=
nullptr,
"removed an item with no parent uuid?" );
634 removedKIIDs.insert( item->Parent()->m_Uuid );
637 FILE* log_f = wxFopen( fname_log.GetAbsolutePath(),
"wb" );
639 added, removedKIIDs, heads,
640 logger->GetEvents() );
645 fname_log.GetAbsolutePath() ) );
649 fprintf( log_f,
"%s\n", logString.c_str().AsChar() );
708 if( currentLayer != activeLayer )
731 std::shared_ptr<DRC_ENGINE>& drcEngine = bds.
m_DRCEngine;
760 if( !constraint.
IsNull() )
788 dummyTrackB.
SetLayer( targetLayer );
796 if( !constraint.
IsNull() )
815 if( !constraint.
IsNull() )
847 wxASSERT_MSG(
false, wxT(
"Unhandled via type" ) );
871 frame()->SetActiveLayer(
905 size_t target_idx = 0;
908 for(
size_t i = 0; i < layers.size(); i++ )
910 if( layers[i] == currentLayer )
917 target_idx = ( idx + 1 ) % layers.size();
920 for(
size_t i = 0; i < layers.size() - 1; i++ )
924 targetLayer = layers[target_idx];
929 if( target_idx >= layers.size() )
944 size_t target_idx = 0;
946 for(
size_t i = 0; i < layers.size(); i++ )
948 if( layers[i] == currentLayer )
955 target_idx = ( idx > 0 ) ? ( idx - 1 ) : ( layers.size() - 1 );
957 for(
size_t i = 0; i < layers.size() - 1; i++ )
961 targetLayer = layers[target_idx];
968 target_idx = layers.size() - 1;
990 if( !enabledLayers.test( targetLayer ) )
996 if( targetLayer == currentLayer )
1016 VIATYPE viaType = VIATYPE::THROUGH;
1017 bool selectLayer =
false;
1022 const int actViaFlags = aEvent.
Parameter<
int>();
1023 selectLayer = actViaFlags & VIA_ACTION_FLAGS::SELECT_LAYER;
1037 endPoint =
frame()->GetCanvas()->ClientToScreen( endPoint );
1042 if( viaType != VIATYPE::THROUGH )
1043 not_allowed_ly.
set( currentLayer );
1045 targetLayer =
frame()->SelectOneLayer(
static_cast<PCB_LAYER_ID>( currentLayer ),
1046 not_allowed_ly, endPoint );
1055 if( viaType != VIATYPE::THROUGH )
1057 if( currentLayer == targetLayer )
1067 if( viaType == VIATYPE::BLIND_BURIED
1068 && ( ( targetLayer ==
B_Cu && currentLayer ==
F_Cu )
1069 || ( targetLayer ==
F_Cu && currentLayer ==
B_Cu ) ) )
1071 viaType = VIATYPE::THROUGH;
1077 if( viaType == VIATYPE::THROUGH )
1087 currentLayer = pairTop;
1088 targetLayer = pairBottom;
1098 if( currentLayer == pairTop || currentLayer == pairBottom )
1102 currentLayer = pairTop;
1103 targetLayer = pairBottom;
1109 targetLayer = pairTop;
1113 if( currentLayer == targetLayer )
1141 if( !constraint.
IsNull() )
1147 if( !constraint.
IsNull() )
1194 if( !
getView()->IsLayerVisible( pcbLayer ) )
1204 frame()->GetBoard()->GetDesignSettings().m_TempOverrideTrackWidth =
false;
1237 m_router->ClearViewDecorations();
1248 frame()->UndoRedoBlock(
true );
1263 frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
1266 frame()->UndoRedoBlock(
false );
1283 frame()->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
1286 auto syncRouterAndFrameLayer =
1295 if( !
getView()->IsLayerVisible( pcbLayer ) )
1312 if( evt->IsCancelInteractive() )
1320 if( evt->IsMotion() )
1332 evt->SetMousePosition( last.value() );
1343 bool* autoRouted = evt->Parameter<
bool*>();
1350 if( autoRouted !=
nullptr )
1359 if( autoRouted !=
nullptr )
1361 *autoRouted =
false;
1375 syncRouterAndFrameLayer();
1396 bool forceFinish = evt->Modifier(
MD_SHIFT );
1397 bool forceCommit =
false;
1402 if( needLayerSwitch )
1412 syncRouterAndFrameLayer();
1433 frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
1445 bool forceFinish =
true;
1446 bool forceCommit =
false;
1451 else if( evt->IsCancelInteractive() || evt->IsActivate()
1457 if( evt->IsActivate() && !evt->IsMoveTool() )
1462 else if( evt->IsUndoRedo() )
1480 evt->SetPassEvent();
1497 if( settingsDlg.
ShowModal() == wxID_OK )
1598 frame->PushTool( aEvent );
1603 frame->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
1614 std::vector<BOARD_CONNECTED_ITEM*> itemList;
1621 itemList.push_back(
pad );
1629 std::shared_ptr<CONNECTIVITY_DATA> connectivity =
frame->GetBoard()->GetConnectivity();
1632 bool groupStart =
true;
1639 RN_NET* net = connectivity->GetRatsnestForNet( item->GetNetCode() );
1644 std::vector<std::shared_ptr<const CN_ANCHOR>> anchors;
1648 std::shared_ptr<const CN_ANCHOR> target = edge.GetTargetNode();
1649 std::shared_ptr<const CN_ANCHOR> source = edge.GetSourceNode();
1651 if( !source || source->Dirty() || !target || target->Dirty() )
1654 if( source->Parent() == item )
1655 anchors.push_back( source );
1656 else if( target->Parent() == item )
1657 anchors.push_back( target );
1661 for( std::shared_ptr<const CN_ANCHOR>
anchor : anchors )
1670 if(
frame->GetActiveLayer() != originalLayer )
1671 frame->SetActiveLayer( originalLayer );
1679 bool autoRouted =
false;
1705 frame->PopTool( pushedEvent );
1733 frame->PushTool( aEvent );
1738 frame->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
1757 if( !evt->IsDrag() )
1760 if( evt->IsCancelInteractive() )
1762 frame->PopTool( pushedEvent );
1765 else if( evt->IsActivate() )
1767 if( evt->IsMoveTool() || evt->IsEditorTool() )
1774 frame->PopTool( pushedEvent );
1786 else if( evt->IsMotion() )
1804 evt->SetPassEvent(
false );
1812 if( evt->HasPosition() )
1825 else if( evt->IsKeyPressed() )
1830 evt->SetPassEvent();
1838 evt->SetPassEvent();
1843 frame->PopTool( pushedEvent );
1867 KIDIALOG dlg(
frame(),
_(
"The selected item is locked." ),
_(
"Confirmation" ),
1868 wxOK | wxCANCEL | wxICON_WARNING );
1869 dlg.SetOKLabel(
_(
"Drag Anyway" ) );
1905 frame()->UndoRedoBlock(
true );
1911 if( evt->IsMotion() )
1920 if( dragger->GetForceMarkObstaclesMode( &dragStatus ) )
1927 hint.Printf(
_(
"(%s to commit anyway.)" ),
1931 statusItem->
SetMessage(
_(
"Track violates DRC." ) );
1939 else if( evt->IsClick(
BUT_LEFT ) )
1941 bool forceFinish =
false;
1942 bool forceCommit = evt->Modifier(
MD_CTRL );
1951 else if( evt->IsCancelInteractive() || evt->IsActivate() )
1956 if( evt->IsActivate() && !evt->IsMoveTool() )
1961 else if( evt->IsUndoRedo() )
1989 evt->SetPassEvent();
1994 evt->SetPassEvent();
2009 frame()->UndoRedoBlock(
false );
2036 if( vias + traces == 0 )
2050 for(
int i = 0; !reference && i < aCollector.
GetCount(); i++ )
2051 reference =
dynamic_cast<PCB_TRACK*
>( aCollector[i] );
2065 refPoint = reference->
GetEnd();
2069 for(
int i = 0; i < aCollector.
GetCount(); i++ )
2073 if( neighbor && neighbor != reference )
2078 if( neighbor->
GetStart() != refPoint && neighbor->
GetEnd() != refPoint )
2085 aCollector.
Append( reference );
2115 std::copy( aOriginalSelection.
Items().begin(), aOriginalSelection.
Items().end(), std::back_inserter( selItems ) );
2143 std::set<FOOTPRINT*> footprints;
2146 footprints.insert(
static_cast<FOOTPRINT*
>( item ) );
2168 bool wasLocked =
false;
2179 frame()->PushTool( aEvent );
2187 bool showCourtyardConflicts =
frame()->GetPcbNewSettings()->m_ShowCourtyardCollisions;
2193 std::vector<BOARD_ITEM*> dynamicItems;
2194 std::unique_ptr<CONNECTIVITY_DATA> dynamicData =
nullptr;
2196 std::vector<PNS::ITEM*> leaderSegments;
2197 bool singleFootprintDrag =
false;
2199 if( !footprints.empty() )
2201 if( footprints.size() == 1 )
2202 singleFootprintDrag =
true;
2204 if( showCourtyardConflicts )
2214 itemsToDrag.
Add( solid );
2218 if( connectivityData->GetRatsnestForPad(
pad ).size() > 0 )
2219 dynamicItems.push_back(
pad );
2226 itemsToDrag.
Add( solid );
2232 || shape->GetLayer() ==
Margin
2236 itemsToDrag.
Add( solid );
2240 if( showCourtyardConflicts )
2244 dynamicData = std::make_unique<CONNECTIVITY_DATA>(
board()->GetConnectivity(),
2245 dynamicItems,
true );
2246 connectivityData->BlockRatsnestItems( dynamicItems );
2250 for(
const EDA_ITEM* selItem : selectedItems )
2252 if( !selItem->IsBOARD_ITEM() )
2265 itemsToDrag.
Add( pnsItem );
2277 std::set<PNS::NET_HANDLE> highlightNetcodes;
2279 if( itemsToDrag.
Count() >= 1 )
2285 if( pitem->Shape( layer )->Collide( p0, 0 ) )
2291 highlightNetcodes.insert( pitem->Net() );
2295 if( highlightNetcodes.size() )
2299 if( !footprints.empty() && singleFootprintDrag )
2325 int dragMode = aEvent.
Parameter<
int> ();
2334 if( !footprints.empty() )
2335 connectivityData->ClearLocalRatsnest();
2342 frame()->PopTool( pushedEvent );
2350 frame()->UndoRedoBlock(
true );
2358 frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
2371 bool hasMouseMoved =
false;
2372 bool hasMultidragCancelled =
false;
2378 if( evt->IsCancelInteractive() || evt->IsActivate() )
2383 hasMultidragCancelled =
true;
2387 else if( evt->IsMotion() || evt->IsDrag(
BUT_LEFT ) )
2389 hasMouseMoved =
true;
2395 if( !footprints.empty() )
2404 previewItem =
static_cast<BOARD_ITEM*
>( drawing->Clone() );
2405 previewItem->
Move( offset );
2414 &&
pad->GetDrillSize().x == 0 )
2417 previewItem->
Move( offset );
2430 previewItem->
Move( offset );
2435 previewItem->
Move( offset );
2439 if( showCourtyardConflicts )
2443 if( showCourtyardConflicts )
2445 courtyardClearanceDRC.
Run();
2453 dynamicData->Move( offset - lastOffset );
2454 lastOffset = offset;
2455 connectivityData->ComputeLocalRatsnest( dynamicItems, dynamicData.get(), offset );
2462 if( dragger->GetForceMarkObstaclesMode( &dragStatus ) )
2467 hint.Printf(
_(
"(%s to commit anyway.)" ),
2471 statusItem->
SetMessage(
_(
"Track violates DRC." ) );
2479 else if( hasMouseMoved && ( evt->IsMouseUp(
BUT_LEFT ) || evt->IsClick(
BUT_LEFT ) ) )
2481 bool forceFinish =
false;
2482 bool forceCommit = evt->Modifier(
MD_CTRL );
2490 else if( evt->IsUndoRedo() )
2518 evt->SetPassEvent();
2523 evt->SetPassEvent();
2529 if( !footprints.empty() )
2546 connectivityData->ClearLocalRatsnest();
2556 if( itemsToDrag.
Size() && hasMultidragCancelled )
2560 else if( leaderSegments.size() )
2562 std::vector<EDA_ITEM*> newItems;
2564 for(
auto lseg : leaderSegments )
2565 newItems.push_back( lseg->Parent() );
2573 frame()->UndoRedoBlock(
false );
2574 frame()->PopTool( pushedEvent );
2626 KIDIALOG dlg(
frame(),
_(
"The selected item is locked." ),
_(
"Confirmation" ),
2627 wxOK | wxCANCEL | wxICON_WARNING );
2628 dlg.SetOKLabel(
_(
"Break Track" ) );
2635 frame()->UndoRedoBlock(
true );
2641 frame()->UndoRedoBlock(
false );
2688 std::vector<MSG_PANEL_ITEM> items;
2696 wxString description;
2702 wxASSERT( nets.size() >= 2 );
2709 description = wxString::Format(
_(
"Routing Diff Pair: %s" ),
2716 if( *netclassA == *netclassB )
2722 secondary = wxString::Format(
_(
"Resolved Netclass: %s" ),
2725 else if( !nets.empty() && nets[0] )
2729 description = wxString::Format(
_(
"Routing Track: %s" ),
2732 secondary = wxString::Format(
2733 _(
"Resolved Netclass: %s" ),
2738 description =
_(
"Routing Track" );
2739 secondary =
_(
"(no net)" );
2742 items.emplace_back( description, secondary );
2744 wxString cornerMode;
2748 cornerMode =
_(
"Free-angle" );
2762 items.emplace_back(
_(
"Corner Style" ), cornerMode );
2772 items.emplace_back(
_(
"Mode" ), mode );
2774#define FORMAT_VALUE( x ) frame()->MessageTextFromValue( x )
2778 items.emplace_back( wxString::Format(
_(
"Track Width: %s" ),
2780 wxString::Format(
_(
"(from %s)" ),
2783 items.emplace_back( wxString::Format(
_(
"Min Clearance: %s" ),
2785 wxString::Format(
_(
"(from %s)" ),
2788 items.emplace_back( wxString::Format(
_(
"Diff Pair Gap: %s" ),
2790 wxString::Format(
_(
"(from %s)" ),
2794 wxASSERT( traces.
Count() == 2 );
2799 items.emplace_back( wxString::Format(
_(
"DP Max Uncoupled-length: %s" ),
2801 wxString::Format(
_(
"(from %s)" ),
2807 items.emplace_back( wxString::Format(
_(
"Track Width: %s" ),
2809 wxString::Format(
_(
"(from %s)" ),
2812 items.emplace_back( wxString::Format(
_(
"Min Clearance: %s" ),
2814 wxString::Format(
_(
"(from %s)" ),
2820 frame()->SetMsgPanel( items );
std::function< void(const VECTOR2I &, GENERAL_COLLECTOR &, PCB_SELECTION_TOOL *)> CLIENT_SELECTION_FILTER
@ switch_corner_rounding_shape
constexpr BOX2I BOX2ISafe(const BOX2D &aInput)
static TOOL_ACTION cancelInteractive
static TOOL_ACTION selectionCursor
Select a single item under the cursor position.
static TOOL_ACTION pasteSpecial
static TOOL_ACTION doDelete
static TOOL_ACTION selectionClear
Clear the current selection.
static TOOL_ACTION finishInteractive
static TOOL_ACTION selectItems
Select a list of items (specified as the event parameter)
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
void SetLayerVisible(int aLayer, bool isVisible)
BASE_SET & set(size_t pos)
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
void SetNet(NETINFO_ITEM *aNetInfo)
Set a NET_INFO object for the item.
Container for design settings for a BOARD object.
void UseCustomTrackViaSize(bool aEnabled)
Enables/disables custom track/via size settings.
void SetCustomDiffPairWidth(int aWidth)
Sets custom track width for differential pairs (i.e.
void SetDiffPairIndex(unsigned aIndex)
int GetCurrentViaSize() const
std::shared_ptr< DRC_ENGINE > m_DRCEngine
bool m_UseConnectedTrackWidth
std::vector< DIFF_PAIR_DIMENSION > m_DiffPairDimensionsList
bool m_TempOverrideTrackWidth
void SetCustomDiffPairGap(int aGap)
Sets custom gap for differential pairs (i.e.
void SetTrackWidthIndex(unsigned aIndex)
Set the current track width list index to aIndex.
void SetViaSizeIndex(unsigned aIndex)
Set the current via size list index to aIndex.
unsigned GetTrackWidthIndex() const
bool UseNetClassVia() const
Return true if netclass values should be used to obtain appropriate via size.
unsigned GetViaSizeIndex() const
bool UseNetClassTrack() const
Return true if netclass values should be used to obtain appropriate track width.
bool UseNetClassDiffPair() const
Return true if netclass values should be used to obtain appropriate diff pair dimensions.
int GetCopperLayerCount() const
void UseCustomDiffPairDimensions(bool aEnabled)
Enables/disables custom differential pair dimensions.
std::vector< int > m_TrackWidthList
unsigned GetDiffPairIndex() const
int GetCurrentViaDrill() const
std::vector< VIA_DIMENSION > m_ViasDimensionsList
void SetCustomDiffPairViaGap(int aGap)
Sets custom via gap for differential pairs (i.e.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
void SetLocked(bool aLocked) override
bool IsLocked() const override
virtual void Move(const VECTOR2I &aMoveVector)
Move this object.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Information pertinent to a Pcbnew printed circuit board.
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
PROJECT * GetProject() const
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
CN_EDGE represents a point-to-point connection, whether realized or unrealized (ie: tracks etc.
void Empty()
Clear the list.
int GetCount() const
Return the number of objects in the list.
int CountType(KICAD_T aType)
Count the number of items matching aType.
void Append(EDA_ITEM *item)
Add an item to the end of the list.
Implementing DIALOG_TRACK_VIA_SIZE_BASE.
@ ROUNDED_90
H/V with filleted corners.
@ MITERED_90
H/V only (90-degree corners)
@ ROUNDED_45
H/V/45 with filleted corners.
@ MITERED_45
H/V/45 with mitered corners (default)
virtual bool Run() override
Run this provider against the given PCB with configured options (if any).
std::vector< FOOTPRINT * > m_FpInMove
void ClearConflicts(KIGFX::VIEW *aView)
void UpdateConflicts(KIGFX::VIEW *aView, bool aHighlightMoved)
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...
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
A base class for most all the KiCad significant classes used in schematics and boards.
void SetFlags(EDA_ITEM_FLAGS aMask)
KICAD_T Type() const
Returns the type of object.
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Used when the right click button is pressed, or when the select tool is in effect.
static const std::vector< KICAD_T > DraggableItems
A scan list for items that can be dragged.
void SetUseGrid(bool aSnapToGrid)
void SetAuxAxes(bool aEnable, const VECTOR2I &aOrigin=VECTOR2I(0, 0))
const std::string FormatAsString()
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
void DoNotShowCheckbox(wxString file, int line)
Shows the 'do not show again' checkbox.
Abstract interface for drawing on a 2D-surface.
BOX2D GetVisibleWorldExtents() const
bool GetGridSnapping() const
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
const std::set< int > & GetHighlightNetCodes() const
Return the netcode of currently highlighted net.
An interface for classes handling user events controlling the view behavior such as zooming,...
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 WarpMouseCursor(const VECTOR2D &aPosition, bool aWorldCoordinates=false, bool aWarpView=false)=0
If enabled (.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
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.
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
bool IsBOARD_ITEM() const
void ShowPreview(bool aShow=true)
virtual int GetTopLayer() const
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
void Hide(VIEW_ITEM *aItem, bool aHide=true, bool aHideOverlay=false)
Temporarily hide the item in the view (e.g.
void AddToPreview(VIEW_ITEM *aItem, bool aTakeOwnership=true)
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
LSET is a set of PCB_LAYER_IDs.
LSEQ UIOrder() const
Return the copper, technical and user layers in the order shown in layer widget.
static LSET AllNonCuMask()
Return a mask holding all layer minus CU layers.
static LSET AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
A collection of nets and the parameters used to route or test these nets.
const wxString GetHumanReadableName() const
Gets the consolidated name of this netclass (which may be an aggregate).
Handle the data for a net.
const wxString & GetNetname() const
static wxString GetDefaultUserProjectsPath()
Gets the default path we point users to create projects.
static TOOL_ACTION_GROUP layerDirectSwitchActions()
static TOOL_ACTION layerToggle
static TOOL_ACTION drag45Degree
static TOOL_ACTION layerInner12
static TOOL_ACTION routerUndoLastSegment
static TOOL_ACTION layerInner8
static TOOL_ACTION layerInner3
static TOOL_ACTION layerPrev
static TOOL_ACTION routerSettingsDialog
Activation of the Push and Shove settings dialogs.
static TOOL_ACTION layerInner2
static TOOL_ACTION routerAttemptFinish
static TOOL_ACTION routeDiffPair
Activation of the Push and Shove router (differential pair mode)
static TOOL_ACTION trackViaSizeChanged
static TOOL_ACTION layerChanged
static TOOL_ACTION layerInner25
static TOOL_ACTION breakTrack
Break a single track into two segments at the cursor.
static TOOL_ACTION routerRouteSelectedFromEnd
static TOOL_ACTION routerHighlightMode
Actions to enable switching modes via hotkey assignments.
static TOOL_ACTION routerWalkaroundMode
static TOOL_ACTION routerShoveMode
static TOOL_ACTION layerInner24
static TOOL_ACTION properties
Activation of the edit tool.
static TOOL_ACTION layerInner29
static TOOL_ACTION routerAutorouteSelected
static TOOL_ACTION layerInner11
static TOOL_ACTION routerDiffPairDialog
static TOOL_ACTION routerContinueFromEnd
static TOOL_ACTION layerInner16
static TOOL_ACTION layerInner26
static TOOL_ACTION layerInner18
static TOOL_ACTION layerInner14
static TOOL_ACTION selectLayerPair
static TOOL_ACTION layerInner6
static TOOL_ACTION dragFreeAngle
static TOOL_ACTION clearHighlight
static TOOL_ACTION layerInner22
static TOOL_ACTION layerInner5
static TOOL_ACTION layerInner20
static TOOL_ACTION layerInner7
static TOOL_ACTION layerInner27
static TOOL_ACTION layerInner1
static TOOL_ACTION layerInner10
static TOOL_ACTION layerInner15
static TOOL_ACTION layerInner17
static TOOL_ACTION layerBottom
static TOOL_ACTION layerInner19
static TOOL_ACTION layerInner9
static TOOL_ACTION routerInlineDrag
Activation of the Push and Shove router (inline dragging mode)
static TOOL_ACTION layerInner30
static TOOL_ACTION layerTop
static TOOL_ACTION cycleRouterMode
static TOOL_ACTION layerInner4
static TOOL_ACTION routeSingleTrack
Activation of the Push and Shove router.
static TOOL_ACTION layerInner13
static TOOL_ACTION layerInner21
static TOOL_ACTION layerNext
static TOOL_ACTION routerRouteSelected
static TOOL_ACTION layerInner23
static TOOL_ACTION layerInner28
Common, abstract interface for edit frames.
APPEARANCE_CONTROLS * GetAppearancePanel()
virtual PCB_LAYER_ID GetActiveLayer() const
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
The main frame for Pcbnew.
void SetActiveLayer(PCB_LAYER_ID aLayer) override
Change the currently active layer to aLayer and also update the APPEARANCE_CONTROLS.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
A #PLUGIN derivation for saving and loading Pcbnew s-expression formatted files.
void SaveBoard(const wxString &aFileName, BOARD *aBoard, const std::map< std::string, UTF8 > *aProperties=nullptr) override
Write aBoard to a storage file in a format that this PCB_IO implementation knows about or it can be u...
PCB_LAYER_ID m_Route_Layer_TOP
PCB_LAYER_ID m_Route_Layer_BOTTOM
void SetEnd(const VECTOR2I &aEnd)
void SetStart(const VECTOR2I &aStart)
const VECTOR2I & GetStart() const
const VECTOR2I & GetEnd() const
EDA_ITEM_FLAGS IsPointOnEnds(const VECTOR2I &point, int min_dist=0) const
Return STARTPOINT if point if near (dist = min_dist) start point, ENDPOINT if point if near (dist = m...
void SetLayerPair(PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer)
For a via m_layer contains the top layer, the other layer is in m_bottomLayer/.
void SetViaType(VIATYPE aViaType)
int Count(int aKindMask=-1) const
void Add(const LINE &aLine)
std::vector< ITEM * > & Items()
Base class for PNS router board items.
const PNS_LAYER_RANGE & Layers() const
virtual NET_HANDLE Net() const
PnsKind Kind() const
Return the type (kind) of the item.
bool OfKind(int aKindMask) const
static wxString FormatLogFileAsString(int aMode, const std::vector< ITEM * > &aAddedItems, const std::set< KIID > &aRemovedItems, const std::vector< ITEM * > &aHeads, const std::vector< EVENT_ENTRY > &aEvents)
ITEM * FindItemByParent(const BOARD_ITEM *aParent)
std::vector< ITEM * > FindItemsByParent(const BOARD_ITEM *aParent)
virtual const VECTOR2I & CurrentEnd() const =0
Function CurrentEnd()
virtual const ITEM_SET Traces()=0
Function Traces()
virtual bool HasPlacedAnything() const
virtual const VECTOR2I & CurrentStart() const =0
Function CurrentStart()
void SetMode(ROUTER_MODE aMode)
bool SwitchLayer(int layer)
void ClearViewDecorations()
PLACEMENT_ALGO * Placer()
std::vector< PNS::ITEM * > GetLastCommittedLeaderSegments()
void BreakSegmentOrArc(ITEM *aItem, const VECTOR2I &aP)
bool ContinueFromEnd(ITEM **aNewStartItem)
void UpdateSizes(const SIZES_SETTINGS &aSizes)
Applies stored settings.
const wxString & FailureReason() const
bool IsPlacingVia() const
RULE_RESOLVER * GetRuleResolver() const
ROUTING_SETTINGS & Settings()
bool RoutingInProgress() const
RouterState GetState() const
std::optional< VECTOR2I > UndoLastSegment()
bool StartDragging(const VECTOR2I &aP, ITEM *aItem, int aDragMode=DM_ANY)
bool StartRouting(const VECTOR2I &aP, ITEM *aItem, int aLayer)
void SetVisibleViewArea(const BOX2I &aExtents)
int GetCurrentLayer() const
void GetUpdatedItems(std::vector< PNS::ITEM * > &aRemoved, std::vector< PNS::ITEM * > &aAdded, std::vector< PNS::ITEM * > &aHeads)
bool FixRoute(const VECTOR2I &aP, ITEM *aItem, bool aForceFinish, bool aForceCommit)
void ToggleViaPlacement()
const std::vector< NET_HANDLE > GetCurrentNets() const
bool GetNearestRatnestAnchor(VECTOR2I &aOtherEnd, PNS_LAYER_RANGE &aOtherEndLayers, ITEM *&aOtherEndItem)
bool Move(const VECTOR2I &aP, ITEM *aItem)
Contain all persistent settings of the router, such as the mode, optimization effort,...
bool GetFreeAngleMode() const
void SetMode(PNS_MODE aMode)
Return the optimizer effort. Bigger means cleaner traces, but slower routing.
PNS_MODE Mode() const
Set the routing mode.
DIRECTION_45::CORNER_MODE GetCornerMode() const
virtual NET_HANDLE DpCoupledNet(NET_HANDLE aNet)=0
void SetViaType(VIATYPE aViaType)
void SetTrackWidth(int aWidth)
int DiffPairWidth() const
void SetDiffPairWidth(int aWidth)
void SetDiffPairWidthSource(const wxString &aSource)
void SetDiffPairGapSource(const wxString &aSource)
void SetDiffPairGap(int aGap)
void SetViaDrill(int aDrill)
wxString GetClearanceSource() const
wxString GetDiffPairGapSource() const
wxString GetDiffPairWidthSource() const
void AddLayerPair(int aL1, int aL2)
void SetClearance(int aClearance)
std::optional< int > PairedLayer(int aLayerId)
bool TrackWidthIsExplicit() const
void SetViaDiameter(int aDiameter)
void SetClearanceSource(const wxString &aSource)
wxString GetWidthSource() const
void SetWidthSource(const wxString &aSource)
int DiffPairViaGap() const
void SetBoard(BOARD *aBoard)
PNS::RULE_RESOLVER * GetRuleResolver() override
void SetStartLayerFromPCBNew(PCB_LAYER_ID aLayer)
PCB_LAYER_ID GetBoardLayerFromPNSLayer(int aLayer) const override
int GetPNSLayerFromBoardLayer(PCB_LAYER_ID aLayer) const override
bool ImportSizes(PNS::SIZES_SETTINGS &aSizes, PNS::ITEM *aStartItem, PNS::NET_HANDLE aNet, VECTOR2D aStartPosition) override
void SetCommitFlags(int aCommitFlags)
Represent a contiguous set of PCB layers.
bool Overlaps(const PNS_LAYER_RANGE &aOther) const
bool SaveAs(const wxString &aDirectory, const wxString &aFile)
bool SaveAs(const wxString &aDirectory, const wxString &aFile)
Container for project specific data.
virtual PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
virtual PROJECT_FILE & GetProjectFile() const
Describe ratsnest for a single net.
const std::vector< CN_EDGE > & GetEdges() const
void SetMessage(const wxString &aStatus)
void SetHint(const wxString &aHint)
void SetPosition(const VECTOR2I &aPos) override
static bool NotEmpty(const SELECTION &aSelection)
Test if there are any items selected.
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
const std::deque< EDA_ITEM * > GetItems() const
int Size() const
Returns the number of selected parts.
std::deque< EDA_ITEM * > & Items()
std::vector< EDA_ITEM * > GetItemsSortedBySelectionOrder() const
bool Empty() const
Checks if there is anything selected.
size_t CountType(KICAD_T aType) const
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
A modified version of the wxInfoBar class that allows us to:
void ShowMessageFor(const wxString &aMessage, int aTime, int aFlags=wxICON_INFORMATION, MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the infobar with the provided message and icon for a specific period of time.
Handle a list of polygons defining a copper zone.
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
This file is part of the common library.
@ VIA_DIAMETER_CONSTRAINT
@ DIFF_PAIR_GAP_CONSTRAINT
std::vector< EDA_ITEM * > EDA_ITEMS
Define list of drawing items for screens.
#define ROUTER_TRANSIENT
transient items that should NOT be cached
#define ENDPOINT
ends. (Used to support dragging.)
std::uint32_t EDA_ITEM_FLAGS
#define STARTPOINT
When a line is selected, these flags indicate which.
static FILENAME_RESOLVER * resolver
a few functions useful in geometry calculations.
VECTOR2< ret_type > GetClampedCoords(const VECTOR2< in_type > &aCoords, pad_type aPadding=1u)
Clamps a vector to values that can be negated, respecting numeric limits of coordinates data type wit...
wxString KeyNameFromKeyCode(int aKeycode, bool *aIsFound)
Return the key name from the key code.
This file is part of the common library.
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
PCB_LAYER_ID
A quick note on layer IDs:
The Cairo implementation of the graphics abstraction layer.
@ RM_MarkObstacles
Ignore collisions, mark obstacles.
@ RM_Walkaround
Only walk around.
@ PNS_MODE_ROUTE_DIFF_PAIR
@ ID_POPUP_PCB_SELECT_WIDTH1
@ ID_POPUP_PCB_SELECT_DIFFPAIR16
@ ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES
@ ID_POPUP_PCB_SELECT_WIDTH16
@ ID_POPUP_PCB_SELECT_AUTO_WIDTH
@ ID_POPUP_PCB_SELECT_CUSTOM_WIDTH
@ ID_POPUP_PCB_SELECT_DIFFPAIR1
@ ID_POPUP_PCB_SELECT_USE_NETCLASS_DIFFPAIR
@ ID_POPUP_PCB_SELECT_VIASIZE1
@ ID_POPUP_PCB_SELECT_CUSTOM_DIFFPAIR
@ ID_POPUP_PCB_SELECT_VIASIZE16
Class that computes missing connections on a PCB.
std::vector< FAB_LAYER_COLOR > dummy
wxString UnescapeString(const wxString &aSource)
Container to handle a stock of specific differential pairs each with unique track width,...
An abstract function object, returning a design rule (clearance, diff pair gap, etc) required between...
Container to handle a stock of specific vias each with unique diameter and drill sizes in the BOARD c...
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
VECTOR2< double > VECTOR2D
wxPoint ToWxPoint(const VECTOR2I &aSize)
wxString AddFileExtListToFilter(const std::vector< std::string > &aExts)
Build the wildcard extension file dialog wildcard filter to add to the base message dialog.