23#include <wx/filedlg.h>
24#include <wx/hyperlink.h>
32using namespace std::placeholders;
115 .Name(
"pcbnew.InteractiveRouter.PlaceVia" )
117 .DefaultHotkey(
'V' )
118 .LegacyHotkeyName(
"Add Through Via" )
119 .FriendlyName(
_(
"Place Through Via" ) )
120 .Tooltip(
_(
"Adds a through-hole via at the end of currently routed track." ) )
126 .Name(
"pcbnew.InteractiveRouter.PlaceBlindVia" )
129 .LegacyHotkeyName(
"Add Blind/Buried Via" )
130 .FriendlyName(
_(
"Place Blind/Buried Via" ) )
131 .Tooltip(
_(
"Adds a blind or buried via at the end of currently routed track.") )
137 .Name(
"pcbnew.InteractiveRouter.PlaceMicroVia" )
139 .DefaultHotkey(
MD_CTRL +
'V' )
140 .LegacyHotkeyName(
"Add MicroVia" )
141 .FriendlyName(
_(
"Place Microvia" ) )
142 .Tooltip(
_(
"Adds a microvia at the end of currently routed track." ) )
148 .Name(
"pcbnew.InteractiveRouter.SelLayerAndPlaceVia" )
150 .DefaultHotkey(
'<' )
151 .LegacyHotkeyName(
"Select Layer and Add Through Via" )
152 .FriendlyName(
_(
"Select Layer and Place Through Via..." ) )
153 .Tooltip(
_(
"Select a layer, then add a through-hole via at the end of currently routed track." ) )
159 .Name(
"pcbnew.InteractiveRouter.SelLayerAndPlaceBlindVia" )
161 .DefaultHotkey(
MD_ALT +
'<' )
162 .LegacyHotkeyName(
"Select Layer and Add Blind/Buried Via" )
163 .FriendlyName(
_(
"Select Layer and Place Blind/Buried Via..." ) )
164 .Tooltip(
_(
"Select a layer, then add a blind or buried via at the end of currently routed track." ) )
170 .Name(
"pcbnew.InteractiveRouter.SelLayerAndPlaceMicroVia" )
172 .FriendlyName(
_(
"Select Layer and Place Micro Via..." ) )
173 .Tooltip(
_(
"Select a layer, then add a micro via at the end of currently routed track." ) )
179 .Name(
"pcbnew.InteractiveRouter.CustomTrackViaSize" )
181 .DefaultHotkey(
'Q' )
182 .LegacyHotkeyName(
"Custom Track/Via Size" )
183 .FriendlyName(
_(
"Custom Track/Via Size..." ) )
184 .Tooltip(
_(
"Shows a dialog for changing the track width and via size." ) )
188 .Name(
"pcbnew.InteractiveRouter.SwitchPosture" )
190 .DefaultHotkey(
'/' )
191 .LegacyHotkeyName(
"Switch Track Posture" )
192 .FriendlyName(
_(
"Switch Track Posture" ) )
193 .Tooltip(
_(
"Switches posture of the currently routed track." ) )
198 .Name(
"pcbnew.InteractiveRouter.SwitchRounding" )
200 .DefaultHotkey(
MD_CTRL +
'/' )
201 .FriendlyName(
_(
"Track Corner Mode" ) )
202 .Tooltip(
_(
"Switches between sharp/rounded and 45°/90° corners when routing tracks." ) )
207 .Name(
"pcbnew.InteractiveRouter.SwitchRounding45" )
209 .DefaultHotkey(
'W' )
210 .FriendlyName(
_(
"Track Corner Mode 45" ) )
211 .Tooltip(
_(
"Switch to 45° corner when routing tracks." ) ) );
214 .Name(
"pcbnew.InteractiveRouter.SwitchRounding90" )
217 .FriendlyName(
_(
"Track Corner Mode 90" ) )
218 .Tooltip(
_(
"Switch to 90° corner when routing tracks." ) ) );
221 .Name(
"pcbnew.InteractiveRouter.SwitchRoundingArc45" )
223 .DefaultHotkey(
MD_CTRL +
'W' )
224 .FriendlyName(
_(
"Track Corner Mode Arc 45" ) )
225 .Tooltip(
_(
"Switch to arc 45° corner when routing tracks." ) ) );
228 .Name(
"pcbnew.InteractiveRouter.SwitchRoundingArc90" )
230 .DefaultHotkey(
MD_ALT +
'W' )
231 .FriendlyName(
_(
"Track Corner Mode Arc 90" ) )
232 .Tooltip(
_(
"Switch to arc 90° corner when routing tracks." ) ) );
235#define _(s) wxGetTranslation((s))
255 SetTitle(
_(
"Select Track/Via Width" ) );
274 _(
"Route using the width of the starting track." ), wxITEM_CHECK );
279 _(
"Use track and via sizes from the net class" ), wxITEM_CHECK );
284 _(
"Specify custom track and via sizes" ), wxITEM_CHECK );
295 msg =
_(
"Track netclass width" );
297 msg.Printf(
_(
"Track %s" ),
m_frame.MessageTextFromValue( width ) );
300 Append( menuIdx, msg, wxEmptyString, wxITEM_CHECK );
311 msg =
_(
"Via netclass values" );
314 if(
via.m_Drill > 0 )
316 msg.Printf(
_(
"Via %s, hole %s" ),
317 m_frame.MessageTextFromValue(
via.m_Diameter ),
318 m_frame.MessageTextFromValue(
via.m_Drill ) );
322 msg.Printf(
_(
"Via %s" ),
323 m_frame.MessageTextFromValue(
via.m_Diameter ) );
328 Append( menuIdx, msg, wxEmptyString, wxITEM_CHECK );
336 int id = aEvent.GetId();
388 SetTitle(
_(
"Select Differential Pair Dimensions" ) );
404 _(
"Use differential pair dimensions from the net class" ), wxITEM_CHECK );
409 _(
"Specify custom differential pair dimensions" ), wxITEM_CHECK );
422 if( diffPair.
m_Gap <= 0 )
426 msg.Printf(
_(
"Width %s" ),
431 msg.Printf(
_(
"Width %s, via gap %s" ),
440 msg.Printf(
_(
"Width %s, gap %s" ),
446 msg.Printf(
_(
"Width %s, gap %s, via gap %s" ),
454 Append( menuIdx, msg, wxEmptyString, wxITEM_CHECK );
462 int id = aEvent.GetId();
506 auto& menu =
m_menu->GetMenu();
507 menu.SetUntranslatedTitle(
_HKI(
"Interactive Router" ) );
527 auto notRoutingCond =
530 return !
m_router->RoutingInProgress();
536 std::vector<PNS::NET_HANDLE> currentNets =
m_router->GetCurrentNets();
538 if( currentNets.empty() || currentNets[0] ==
nullptr )
545 RN_NET* ratsnest =
board->GetConnectivity()->GetRatsnestForNet( currentNet );
547 return ratsnest && !ratsnest->
GetEdges().empty();
551 menu.AddSeparator( 1 );
554 menu.AddSeparator( haveHighlight, 2 );
579 submenuCornerMode->
SetTitle(
_(
"Track Corner Mode" ) );
587 menu.AddMenu( submenuCornerMode );
590 auto cornerMode45Cond =
596 auto cornerMode90Cond =
602 auto cornerModeArc45Cond =
608 auto cornerModeArc90Cond =
614#define CHECK( x ) ACTION_CONDITIONS().Check( x )
653 static size_t lastLoggerSize = 0;
657 if( !logger || logger->GetEvents().size() == 0
658 || logger->GetEvents().size() == lastLoggerSize )
663 wxFileDialog dlg(
frame(),
_(
"Save router log" ), mruPath,
"pns.log",
665 wxFD_OVERWRITE_PROMPT | wxFD_SAVE );
667 if( dlg.ShowModal() != wxID_OK )
669 lastLoggerSize = logger->GetEvents().size();
673 wxFileName fname_log( dlg.GetPath() );
674 mruPath = fname_log.GetPath();
676 wxFileName fname_dump( fname_log );
677 fname_dump.SetExt(
"dump" );
679 wxFileName fname_settings( fname_log );
680 fname_settings.SetExt(
"settings" );
682 FILE* settings_f = wxFopen( fname_settings.GetAbsolutePath(),
"wb" );
683 std::string settingsStr =
m_router->Settings().FormatAsString();
684 fprintf( settings_f,
"%s\n", settingsStr.c_str() );
685 fclose( settings_f );
692 pcb_io.
SaveBoard( fname_dump.GetAbsolutePath(),
m_iface->GetBoard(),
nullptr );
699 std::vector<PNS::ITEM*> added, removed, heads;
700 m_router->GetUpdatedItems( removed, added, heads );
702 std::set<KIID> removedKIIDs;
704 for(
auto item : removed )
706 wxASSERT_MSG( item->Parent() !=
nullptr,
"removed an item with no parent uuid?" );
709 removedKIIDs.insert( item->Parent()->m_Uuid );
712 FILE* log_f = wxFopen( fname_log.GetAbsolutePath(),
"wb" );
714 added, removedKIIDs, heads,
715 logger->GetEvents() );
720 fname_log.GetAbsolutePath() ) );
724 fprintf( log_f,
"%s\n", logString.c_str().AsChar() );
760 bool asChanged =
false;
800 int startLayer =
m_iface->GetPNSLayerFromBoardLayer( tl );
806 return m_iface->GetBoardLayerFromPNSLayer( ls.
Start() );
815 int activeLayer =
m_iface->GetPNSLayerFromBoardLayer(
frame()->GetActiveLayer() );
816 int currentLayer =
m_router->GetCurrentLayer();
818 if( currentLayer != activeLayer )
819 m_router->SwitchLayer( activeLayer );
821 std::optional<int> newLayer =
m_router->Sizes().PairedLayer( currentLayer );
824 newLayer =
m_router->Sizes().GetLayerTop();
837 std::vector<PNS::NET_HANDLE> nets =
m_router->GetCurrentNets();
841 std::shared_ptr<DRC_ENGINE>& drcEngine = bds.
m_DRCEngine;
870 if( !constraint.
IsNull() )
898 dummyTrackB.
SetLayer( targetLayer );
906 if( !constraint.
IsNull() )
925 if( !constraint.
IsNull() )
959 wxASSERT_MSG(
false, wxT(
"Unhandled via type" ) );
983 frame()->SetActiveLayer(
1017 size_t target_idx = 0;
1020 for(
size_t i = 0; i < layers.size(); i++ )
1022 if( layers[i] == currentLayer )
1029 target_idx = ( idx + 1 ) % layers.size();
1032 for(
size_t i = 0; i < layers.size() - 1; i++ )
1036 targetLayer = layers[target_idx];
1041 if( target_idx >= layers.size() )
1056 size_t target_idx = 0;
1058 for(
size_t i = 0; i < layers.size(); i++ )
1060 if( layers[i] == currentLayer )
1067 target_idx = ( idx > 0 ) ? ( idx - 1 ) : ( layers.size() - 1 );
1069 for(
size_t i = 0; i < layers.size() - 1; i++ )
1073 targetLayer = layers[target_idx];
1077 if( target_idx > 0 )
1080 target_idx = layers.size() - 1;
1102 if( !enabledLayers.test( targetLayer ) )
1108 if( targetLayer == currentLayer )
1129 bool selectLayer =
false;
1134 const int actViaFlags = aEvent.
Parameter<
int>();
1149 endPoint =
frame()->GetCanvas()->ClientToScreen( endPoint );
1155 not_allowed_ly.
set( currentLayer );
1157 targetLayer =
frame()->SelectOneLayer(
static_cast<PCB_LAYER_ID>( currentLayer ),
1158 not_allowed_ly, endPoint );
1169 if( currentLayer == targetLayer )
1180 && ( ( targetLayer ==
B_Cu && currentLayer ==
F_Cu )
1181 || ( targetLayer ==
F_Cu && currentLayer ==
B_Cu ) ) )
1196 if( !
m_router->GetNearestRatnestAnchor( otherEnd, otherEndLayers, otherEndItem ) )
1199 currentLayer = pairTop;
1200 targetLayer = pairBottom;
1207 const std::optional<int> pairedLayerPns =
m_router->Sizes().PairedLayer(
m_router->GetCurrentLayer() );
1209 if( currentLayer == otherEndLayerPcbId && pairedLayerPns.has_value() )
1213 targetLayer =
m_iface->GetBoardLayerFromPNSLayer( *pairedLayerPns );
1217 targetLayer =
m_iface->GetBoardLayerFromPNSLayer( otherEndLayers.
Start() );
1223 if( currentLayer == pairTop || currentLayer == pairBottom )
1227 currentLayer = pairTop;
1228 targetLayer = pairBottom;
1234 targetLayer = pairTop;
1238 if( currentLayer == targetLayer )
1258 if( !
m_router->GetCurrentNets().empty() )
1266 if( !constraint.
IsNull() )
1272 if( !constraint.
IsNull() )
1283 m_iface->GetPNSLayerFromBoardLayer( targetLayer ) );
1290 if(
m_router->RoutingInProgress() )
1308 int pnsLayer =
m_iface->GetPNSLayerFromBoardLayer( pcbLayer );
1319 if( !
getView()->IsLayerVisible( pcbLayer ) )
1327 m_iface->SetStartLayerFromPCBNew( pcbLayer );
1329 frame()->GetBoard()->GetDesignSettings().m_TempOverrideTrackWidth =
false;
1332 m_iface->GetPNSLayerFromBoardLayer(
frame()->GetScreen()->m_Route_Layer_BOTTOM ) );
1362 m_router->ClearViewDecorations();
1373 frame()->UndoRedoBlock(
true );
1391 frame()->UndoRedoBlock(
false );
1411 auto syncRouterAndFrameLayer =
1414 int pnsLayer =
m_router->GetCurrentLayer();
1420 if( !
getView()->IsLayerVisible( pcbLayer ) )
1435 if( !
m_router->RoutingInProgress() )
1437 if( evt->IsCancelInteractive() )
1445 if( evt->IsMotion() )
1454 if( std::optional<VECTOR2I> last =
m_router->UndoLastSegment() )
1457 evt->SetMousePosition( last.value() );
1468 bool* autoRouted = evt->Parameter<
bool*>();
1475 if( autoRouted !=
nullptr )
1484 if( autoRouted !=
nullptr )
1486 *autoRouted =
false;
1496 bool needsAppend =
m_router->Placer()->HasPlacedAnything();
1500 syncRouterAndFrameLayer();
1512 frame()->ShowInfoBarError(
m_router->FailureReason(),
true );
1520 bool needLayerSwitch =
m_router->IsPlacingVia();
1521 bool forceFinish = evt->Modifier(
MD_SHIFT );
1522 bool forceCommit =
false;
1527 if( needLayerSwitch )
1537 syncRouterAndFrameLayer();
1563 bool forceFinish =
true;
1564 bool forceCommit =
false;
1569 else if( evt->IsCancelInteractive() || evt->IsActivate()
1572 if( evt->IsCancelInteractive() && !
m_router->RoutingInProgress() )
1575 if( evt->IsActivate() && !evt->IsMoveTool() )
1580 else if( evt->IsUndoRedo() )
1598 evt->SetPassEvent();
1615 if( settingsDlg.
ShowModal() == wxID_OK )
1647 settings.SetMode( mode );
1675 return m_router->Settings().Mode();
1681 return m_router->RoutingInProgress();
1704 if(
m_router->RoutingInProgress() )
1716 frame->PushTool( aEvent );
1727 controls->ForceCursorPosition(
false );
1732 std::vector<BOARD_CONNECTED_ITEM*> itemList;
1739 itemList.push_back(
pad );
1747 std::shared_ptr<CONNECTIVITY_DATA> connectivity =
frame->GetBoard()->GetConnectivity();
1750 bool groupStart =
true;
1757 RN_NET* net = connectivity->GetRatsnestForNet( item->GetNetCode() );
1762 std::vector<std::shared_ptr<const CN_ANCHOR>> anchors;
1766 std::shared_ptr<const CN_ANCHOR> target = edge.GetTargetNode();
1767 std::shared_ptr<const CN_ANCHOR> source = edge.GetSourceNode();
1769 if( !source || source->Dirty() || !target || target->Dirty() )
1772 if( source->Parent() == item )
1773 anchors.push_back( source );
1774 else if( target->Parent() == item )
1775 anchors.push_back( target );
1779 for( std::shared_ptr<const CN_ANCHOR>
anchor : anchors )
1788 if(
frame->GetActiveLayer() != originalLayer )
1789 frame->SetActiveLayer( originalLayer );
1797 bool autoRouted =
false;
1823 frame->PopTool( pushedEvent );
1839 if(
m_router->RoutingInProgress() )
1851 frame->PushTool( aEvent );
1862 controls->ForceCursorPosition(
false );
1875 if( !evt->IsDrag() )
1878 if( evt->IsCancelInteractive() )
1880 frame->PopTool( pushedEvent );
1883 else if( evt->IsActivate() )
1885 if( evt->IsMoveTool() || evt->IsEditorTool() )
1892 frame->PopTool( pushedEvent );
1904 else if( evt->IsMotion() )
1922 evt->SetPassEvent(
false );
1930 if( evt->HasPosition() )
1943 else if( evt->IsKeyPressed() )
1948 evt->SetPassEvent();
1956 evt->SetPassEvent();
1961 frame->PopTool( pushedEvent );
1985 KIDIALOG dlg(
frame(),
_(
"The selected item is locked." ),
_(
"Confirmation" ),
1986 wxOK | wxCANCEL | wxICON_WARNING );
1987 dlg.SetOKLabel(
_(
"Drag Anyway" ) );
1997 if(
m_router->RoutingInProgress() )
2023 frame()->UndoRedoBlock(
true );
2029 if( evt->IsMotion() )
2038 if( dragger->GetForceMarkObstaclesMode( &dragStatus ) )
2045 hint.Printf(
_(
"(%s to commit anyway.)" ),
2049 statusItem->
SetMessage(
_(
"Track violates DRC." ) );
2057 else if( evt->IsClick(
BUT_LEFT ) )
2059 bool forceFinish =
false;
2060 bool forceCommit = evt->Modifier(
MD_CTRL );
2069 else if( evt->IsCancelInteractive() || evt->IsActivate() )
2074 if( evt->IsActivate() && !evt->IsMoveTool() )
2079 else if( evt->IsUndoRedo() )
2107 evt->SetPassEvent();
2112 evt->SetPassEvent();
2121 if(
m_router->RoutingInProgress() )
2127 frame()->UndoRedoBlock(
false );
2154 if( vias + traces == 0 )
2168 for(
int i = 0; !reference && i < aCollector.
GetCount(); i++ )
2169 reference =
dynamic_cast<PCB_TRACK*
>( aCollector[i] );
2183 refPoint = reference->
GetEnd();
2187 for(
int i = 0; i < aCollector.
GetCount(); i++ )
2191 if( neighbor && neighbor != reference )
2196 if( neighbor->
GetStart() != refPoint && neighbor->
GetEnd() != refPoint )
2203 aCollector.
Append( reference );
2233 std::copy( aOriginalSelection.
Items().begin(), aOriginalSelection.
Items().end(), std::back_inserter( selItems ) );
2249 std::deque<EDA_ITEM*> selectedItems =
selection.GetItems();
2261 std::set<FOOTPRINT*> footprints;
2264 footprints.insert(
static_cast<FOOTPRINT*
>( item ) );
2269 for(
int idx = 1; idx <
selection.Size(); ++idx )
2271 if( !
selection.GetItem( idx )->IsBOARD_ITEM() )
2286 bool wasLocked =
false;
2297 frame()->PushTool( aEvent );
2305 bool showCourtyardConflicts =
frame()->GetPcbNewSettings()->m_ShowCourtyardCollisions;
2307 std::shared_ptr<DRC_ENGINE> drcEngine =
m_toolMgr->GetTool<
DRC_TOOL>()->GetDRCEngine();
2311 std::vector<BOARD_ITEM*> dynamicItems;
2312 std::unique_ptr<CONNECTIVITY_DATA> dynamicData =
nullptr;
2314 std::vector<PNS::ITEM*> leaderSegments;
2315 bool singleFootprintDrag =
false;
2317 if( !footprints.empty() )
2319 if( footprints.size() == 1 )
2320 singleFootprintDrag =
true;
2322 if( showCourtyardConflicts )
2332 itemsToDrag.
Add( solid );
2336 if( connectivityData->GetRatsnestForPad(
pad ).size() > 0 )
2337 dynamicItems.push_back(
pad );
2344 itemsToDrag.
Add( solid );
2350 || shape->GetLayer() ==
Margin
2354 itemsToDrag.
Add( solid );
2358 if( showCourtyardConflicts )
2362 dynamicData = std::make_unique<CONNECTIVITY_DATA>(
board()->GetConnectivity(),
2363 dynamicItems,
true );
2364 connectivityData->BlockRatsnestItems( dynamicItems );
2368 for(
const EDA_ITEM* selItem : selectedItems )
2370 if( !selItem->IsBOARD_ITEM() )
2383 itemsToDrag.
Add( pnsItem );
2395 if( itemsToDrag.
Count() >= 1 )
2400 SEG::ecoord closestDistSq = std::numeric_limits<SEG::ecoord>::max();
2404 SEG::ecoord distSq = pitem->Shape( layer )->SquaredDistance( p0, 0 );
2406 if( distSq < closestDistSq )
2408 closestDistSq = distSq;
2409 closestItem = pitem;
2419 if( closestItem->
Net() )
2424 if( !footprints.empty() && singleFootprintDrag )
2435 tweakedMousePos =
footprint->GetPosition();
2450 int dragMode = aEvent.
Parameter<
int> ();
2452 bool dragStarted =
m_router->StartDragging( p, itemsToDrag, dragMode );
2459 if( !footprints.empty() )
2460 connectivityData->ClearLocalRatsnest();
2467 frame()->PopTool( pushedEvent );
2475 frame()->UndoRedoBlock(
true );
2496 bool hasMouseMoved =
false;
2497 bool hasMultidragCancelled =
false;
2503 if( evt->IsCancelInteractive() || evt->IsActivate() )
2508 hasMultidragCancelled =
true;
2512 else if( evt->IsMotion() || evt->IsDrag(
BUT_LEFT ) )
2514 hasMouseMoved =
true;
2520 if( !footprints.empty() )
2529 previewItem =
static_cast<BOARD_ITEM*
>( drawing->Clone() );
2530 previewItem->
Move( offset );
2539 &&
pad->GetDrillSize().x == 0 )
2542 previewItem->
Move( offset );
2555 previewItem->
Move( offset );
2560 previewItem->
Move( offset );
2564 if( showCourtyardConflicts )
2568 if( showCourtyardConflicts )
2570 courtyardClearanceDRC.
Run();
2578 dynamicData->Move( offset - lastOffset );
2579 lastOffset = offset;
2580 connectivityData->ComputeLocalRatsnest( dynamicItems, dynamicData.get(), offset );
2587 if( dragger->GetForceMarkObstaclesMode( &dragStatus ) )
2592 hint.Printf(
_(
"(%s to commit anyway.)" ),
2596 statusItem->
SetMessage(
_(
"Track violates DRC." ) );
2604 else if( hasMouseMoved && ( evt->IsMouseUp(
BUT_LEFT ) || evt->IsClick(
BUT_LEFT ) ) )
2606 bool forceFinish =
false;
2607 bool forceCommit = evt->Modifier(
MD_CTRL );
2611 leaderSegments =
m_router->GetLastCommittedLeaderSegments();
2615 else if( evt->IsUndoRedo() )
2643 evt->SetPassEvent();
2648 evt->SetPassEvent();
2654 if( !footprints.empty() )
2671 connectivityData->ClearLocalRatsnest();
2677 if(
m_router->RoutingInProgress() )
2681 if( itemsToDrag.
Size() && hasMultidragCancelled )
2685 else if( leaderSegments.size() )
2687 std::vector<EDA_ITEM*> newItems;
2689 for(
auto lseg : leaderSegments )
2690 newItems.push_back( lseg->Parent() );
2698 frame()->UndoRedoBlock(
false );
2699 frame()->PopTool( pushedEvent );
2751 KIDIALOG dlg(
frame(),
_(
"The selected item is locked." ),
_(
"Confirmation" ),
2752 wxOK | wxCANCEL | wxICON_WARNING );
2753 dlg.SetOKLabel(
_(
"Break Track" ) );
2760 frame()->UndoRedoBlock(
true );
2763 if(
m_router->RoutingInProgress() )
2766 frame()->UndoRedoBlock(
false );
2794 if( !
m_router->GetCurrentNets().empty() )
2813 std::vector<MSG_PANEL_ITEM> items;
2820 std::vector<PNS::NET_HANDLE> nets =
m_router->GetCurrentNets();
2821 wxString description;
2827 wxASSERT( nets.size() >= 2 );
2834 description = wxString::Format(
_(
"Routing Diff Pair: %s" ),
2841 if( *netclassA == *netclassB )
2847 secondary = wxString::Format(
_(
"Resolved Netclass: %s" ),
2850 else if( !nets.empty() && nets[0] )
2854 description = wxString::Format(
_(
"Routing Track: %s" ),
2857 secondary = wxString::Format(
2858 _(
"Resolved Netclass: %s" ),
2863 description =
_(
"Routing Track" );
2864 secondary =
_(
"(no net)" );
2867 items.emplace_back( description, secondary );
2869 wxString cornerMode;
2871 if(
m_router->Settings().GetFreeAngleMode() )
2873 cornerMode =
_(
"Free-angle" );
2877 switch(
m_router->Settings().GetCornerMode() )
2887 items.emplace_back(
_(
"Corner Style" ), cornerMode );
2889 switch(
m_router->Settings().Mode() )
2897 items.emplace_back(
_(
"Mode" ), mode );
2899#define FORMAT_VALUE( x ) frame()->MessageTextFromValue( x )
2903 items.emplace_back( wxString::Format(
_(
"Track Width: %s" ),
2905 wxString::Format(
_(
"(from %s)" ),
2908 items.emplace_back( wxString::Format(
_(
"Min Clearance: %s" ),
2910 wxString::Format(
_(
"(from %s)" ),
2913 items.emplace_back( wxString::Format(
_(
"Diff Pair Gap: %s" ),
2915 wxString::Format(
_(
"(from %s)" ),
2919 wxASSERT( traces.
Count() == 2 );
2922 traces[1],
m_router->GetCurrentLayer(), &constraint ) )
2924 items.emplace_back( wxString::Format(
_(
"DP Max Uncoupled-length: %s" ),
2926 wxString::Format(
_(
"(from %s)" ),
2932 items.emplace_back( wxString::Format(
_(
"Track Width: %s" ),
2934 wxString::Format(
_(
"(from %s)" ),
2937 items.emplace_back( wxString::Format(
_(
"Min Clearance: %s" ),
2939 wxString::Format(
_(
"(from %s)" ),
2945 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)
Manage TOOL_ACTION objects.
void SetConditions(const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions)
Set the conditions the UI elements for activating a specific tool action should use for determining t...
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.
int GetCurrentViaSize() const
void SetViaSizeIndex(int aIndex)
Set the current via size list index to aIndex.
std::shared_ptr< DRC_ENGINE > m_DRCEngine
bool m_UseConnectedTrackWidth
int GetTrackWidthIndex() const
int GetViaSizeIndex() const
int GetDiffPairIndex() const
std::vector< DIFF_PAIR_DIMENSION > m_DiffPairDimensionsList
void SetDiffPairIndex(int aIndex)
bool m_TempOverrideTrackWidth
void SetCustomDiffPairGap(int aGap)
Sets custom gap for differential pairs (i.e.
bool UseNetClassVia() const
Return true if netclass values should be used to obtain appropriate via size.
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.
void SetTrackWidthIndex(int aIndex)
Set the current track width list index to aIndex.
int GetCopperLayerCount() const
void UseCustomDiffPairDimensions(bool aEnabled)
Enables/disables custom differential pair dimensions.
std::vector< int > m_TrackWidthList
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.
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...
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)
DRC_CONSTRAINT EvalRules(DRC_CONSTRAINT_T aConstraintType, const BOARD_ITEM *a, const BOARD_ITEM *b, PCB_LAYER_ID aLayer, REPORTER *aReporter=nullptr)
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.
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.
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
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.
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)
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(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
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.
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.
virtual NET_HANDLE Net() const
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)
Contain all persistent settings of the router, such as the mode, optimization effort,...
void SetMode(PNS_MODE aMode)
Return the optimizer effort. Bigger means cleaner traces, but slower routing.
PNS_MODE Mode() const
Set the routing mode.
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)
bool TrackWidthIsExplicit() const
void SetViaDiameter(int aDiameter)
void SetClearanceSource(const wxString &aSource)
wxString GetWidthSource() const
void SetWidthSource(const wxString &aSource)
int DiffPairViaGap() const
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
VECTOR2I::extended_type ecoord
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).
std::deque< EDA_ITEM * > & Items()
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.
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< int32_t > VECTOR2I
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.