KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcbnew/cross-probing.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-3.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24
33
34#include <wx/tokenzr.h>
35#include <board.h>
37#include <fmt.h>
38#include <footprint.h>
39#include <pad.h>
40#include <pcb_track.h>
41#include <pcb_group.h>
42#include <zone.h>
43#include <collectors.h>
44#include <eda_dde.h>
45#include <kiface_base.h>
46#include <kiway_mail.h>
47#include <string_utils.h>
50#include <gal/painter.h>
51#include <pcb_painter.h>
52#include <pcb_edit_frame.h>
53#include <pcbnew_settings.h>
54#include <render_settings.h>
55#include <richio.h>
56#include <tool/tool_manager.h>
57#include <tools/pcb_actions.h>
59#include <trace_helpers.h>
62#include <widgets/kistatusbar.h>
63#include <project_pcb.h>
65#include <wx/log.h>
66
67/* Execute a remote command sent via a socket on port KICAD_PCB_PORT_SERVICE_NUMBER
68 *
69 * Commands are:
70 *
71 * $NET: "net name" Highlight the given net
72 * $NETS: "net name 1,net name 2" Highlight all given nets
73 * $CLEAR Clear existing highlight
74 *
75 * $CONFIG Show the Manage Footprint Libraries dialog
76 * $CUSTOM_RULES Show the "Custom Rules" page of the Board Setup dialog
77 * $DRC Show the DRC dialog
78 */
79void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
80{
81 char line[1024];
82 char* idcmd;
83 char* text;
84 int netcode = -1;
85 bool multiHighlight = false;
86 BOARD* pcb = GetBoard();
87
89
90 KIGFX::VIEW* view = m_toolManager->GetView();
91 KIGFX::RENDER_SETTINGS* renderSettings = view->GetPainter()->GetSettings();
92
93 strncpy( line, cmdline, sizeof(line) - 1 );
94 line[sizeof(line) - 1] = 0;
95
96 idcmd = strtok( line, " \n\r" );
97 text = strtok( nullptr, "\"\n\r" );
98
99 if( idcmd == nullptr )
100 return;
101
102 if( strcmp( idcmd, "$CONFIG" ) == 0 )
103 {
105 return;
106 }
107 else if( strcmp( idcmd, "$CUSTOM_RULES" ) == 0 )
108 {
109 ShowBoardSetupDialog( _( "Custom Rules" ) );
110 return;
111 }
112 else if( strcmp( idcmd, "$DRC" ) == 0 )
113 {
115 return;
116 }
117 else if( strcmp( idcmd, "$CLEAR" ) == 0 )
118 {
119 auto* pcbRender = dynamic_cast<KIGFX::PCB_RENDER_SETTINGS*>( renderSettings );
120
121 bool hadHighlight = renderSettings->IsHighlightEnabled();
122 bool hadChain = pcbRender && !pcbRender->GetHighlightedNetChain().IsEmpty();
123
124 if( hadHighlight )
125 renderSettings->SetHighlight( false );
126
127 if( hadChain )
128 pcbRender->SetHighlightedNetChain( wxString() );
129
130 if( hadHighlight || hadChain )
131 view->UpdateAllLayersColor();
132
133 if( pcb->IsHighLightNetON() )
134 {
135 pcb->ResetNetHighLight();
136 SetMsgPanel( pcb );
137 }
138
139 GetCanvas()->Refresh();
140 return;
141 }
142 else if( strcmp( idcmd, "$NET:" ) == 0 )
143 {
144 if( !crossProbingSettings.auto_highlight )
145 return;
146
147 wxString net_name = From_UTF8( text );
148
149 NETINFO_ITEM* netinfo = pcb->FindNet( net_name );
150
151 if( netinfo )
152 {
153 netcode = netinfo->GetNetCode();
154
155 std::vector<MSG_PANEL_ITEM> items;
156 netinfo->GetMsgPanelInfo( this, items );
157 SetMsgPanel( items );
158
159 // If the incoming net belongs to a net chain, promote the single-net
160 // highlight into a multi-net highlight covering every chain member so
161 // the PCB mirrors the chain highlight happening on the schematic side.
162 const wxString& chainName = netinfo->GetNetChain();
163
164 if( !chainName.IsEmpty() )
165 {
166 pcb->SetHighLightNet( netcode );
167 renderSettings->SetHighlight( true, netcode );
168 multiHighlight = true;
169
170 for( NETINFO_ITEM* candidate : pcb->GetNetInfo() )
171 {
172 if( !candidate || candidate == netinfo )
173 continue;
174
175 if( candidate->GetNetChain() == chainName )
176 {
177 pcb->SetHighLightNet( candidate->GetNetCode(), true );
178 renderSettings->SetHighlight( true, candidate->GetNetCode(), true );
179 }
180 }
181
182 if( auto* pcbRender = dynamic_cast<KIGFX::PCB_RENDER_SETTINGS*>( renderSettings ) )
183 pcbRender->SetHighlightedNetChain( chainName );
184
185 netcode = -1;
186 }
187 }
188
189 // fall through to highlighting section
190 }
191 else if( strcmp( idcmd, "$NETS:" ) == 0 )
192 {
193 if( !crossProbingSettings.auto_highlight )
194 return;
195
196 wxStringTokenizer netsTok = wxStringTokenizer( From_UTF8( text ), ",", wxTOKEN_STRTOK );
197 bool first = true;
198
199 while( netsTok.HasMoreTokens() )
200 {
201 NETINFO_ITEM* netinfo = pcb->FindNet( netsTok.GetNextToken().Trim( true ).Trim( false ) );
202
203 if( netinfo )
204 {
205 if( first )
206 {
207 // TODO: Once buses are included in netlist, show bus name
208 std::vector<MSG_PANEL_ITEM> items;
209 netinfo->GetMsgPanelInfo( this, items );
210 SetMsgPanel( items );
211 first = false;
212
213 pcb->SetHighLightNet( netinfo->GetNetCode() );
214 renderSettings->SetHighlight( true, netinfo->GetNetCode() );
215 multiHighlight = true;
216 }
217 else
218 {
219 pcb->SetHighLightNet( netinfo->GetNetCode(), true );
220 renderSettings->SetHighlight( true, netinfo->GetNetCode(), true );
221 }
222 }
223 }
224
225 netcode = -1;
226
227 // fall through to highlighting section
228 }
229
230 BOX2I bbox;
231
232 if( netcode > 0 || multiHighlight )
233 {
234 if( !multiHighlight )
235 {
236 renderSettings->SetHighlight( ( netcode >= 0 ), netcode );
237 pcb->SetHighLightNet( netcode );
238 }
239 else
240 {
241 // Just pick the first one for area calculation
242 netcode = *pcb->GetHighLightNetCodes().begin();
243 }
244
245 pcb->HighLightON();
246
247 auto merge_area =
248 [netcode, &bbox]( BOARD_CONNECTED_ITEM* aItem )
249 {
250 if( aItem->GetNetCode() == netcode )
251 bbox.Merge( aItem->GetBoundingBox() );
252 };
253
254 if( crossProbingSettings.center_on_items )
255 {
256 for( ZONE* zone : pcb->Zones() )
257 merge_area( zone );
258
259 for( PCB_TRACK* track : pcb->Tracks() )
260 merge_area( track );
261
262 for( FOOTPRINT* fp : pcb->Footprints() )
263 {
264 for( PAD* p : fp->Pads() )
265 merge_area( p );
266 }
267 }
268 }
269 else
270 {
271 renderSettings->SetHighlight( false );
272 }
273
274 if( crossProbingSettings.center_on_items && bbox.GetWidth() != 0 && bbox.GetHeight() != 0 )
275 {
276 if( crossProbingSettings.zoom_to_fit )
277 GetToolManager()->GetTool<PCB_SELECTION_TOOL>()->ZoomFitCrossProbeBBox( bbox );
278
279 FocusOnLocation( bbox.Centre() );
280 }
281
282 view->UpdateAllLayersColor();
283
284 // Ensure the display is refreshed, because in some installs the refresh is done only
285 // when the gal canvas has the focus, and that is not the case when crossprobing from
286 // Eeschema:
287 GetCanvas()->Refresh();
288}
289
290
291std::string FormatProbeItem( BOARD_ITEM* aItem )
292{
293 if( !aItem )
294 return "$CLEAR: \"HIGHLIGHTED\""; // message to clear highlight state
295
296 switch( aItem->Type() )
297 {
298 case PCB_FOOTPRINT_T:
299 {
300 FOOTPRINT* footprint = static_cast<FOOTPRINT*>( aItem );
301 return fmt::format( "$PART: \"{}\"", TO_UTF8( footprint->GetReference() ) );
302 }
303
304 case PCB_PAD_T:
305 {
306 PAD* pad = static_cast<PAD*>( aItem );
307 FOOTPRINT* footprint = pad->GetParentFootprint();
308
309 return fmt::format( "$PART: \"{}\" $PAD: \"{}\"",
310 TO_UTF8( footprint->GetReference() ),
311 TO_UTF8( pad->GetNumber() ) );
312 }
313
314 case PCB_FIELD_T:
315 {
316 PCB_FIELD* field = static_cast<PCB_FIELD*>( aItem );
317 FOOTPRINT* footprint = field->GetParentFootprint();
318 const char* text_key;
319
320 /* This can't be a switch since the break need to pull out
321 * from the outer switch! */
322 if( field->IsReference() )
323 text_key = "$REF:";
324 else if( field->IsValue() )
325 text_key = "$VAL:";
326 else
327 break;
328
329 return fmt::format( "$PART: \"{}\" {} \"{}\"",
330 TO_UTF8( footprint->GetReference() ),
331 text_key,
332 TO_UTF8( field->GetText() ) );
333 }
334
335 default:
336 break;
337 }
338
339 return "";
340}
341
342
343template <typename ItemContainer>
344void collectItemsForSyncParts( ItemContainer& aItems, std::set<wxString>& parts )
345{
346 for( EDA_ITEM* item : aItems )
347 {
348 switch( item->Type() )
349 {
350 case PCB_GROUP_T:
351 {
352 PCB_GROUP* group = static_cast<PCB_GROUP*>( item );
353
354 collectItemsForSyncParts( group->GetItems(), parts );
355 break;
356 }
357 case PCB_FOOTPRINT_T:
358 {
359 FOOTPRINT* footprint = static_cast<FOOTPRINT*>( item );
360 wxString ref = footprint->GetReference();
361
362 parts.emplace( wxT( "F" ) + EscapeString( ref, CTX_IPC ) );
363 break;
364 }
365
366 case PCB_PAD_T:
367 {
368 PAD* pad = static_cast<PAD*>( item );
369 wxString ref = pad->GetParentFootprint()->GetReference();
370
371 parts.emplace( wxT( "P" ) + EscapeString( ref, CTX_IPC ) + wxT( "/" )
372 + EscapeString( pad->GetNumber(), CTX_IPC ) );
373 break;
374 }
375
376 default: break;
377 }
378 }
379}
380
381
382void PCB_EDIT_FRAME::SendSelectItemsToSch( const std::deque<EDA_ITEM*>& aItems,
383 EDA_ITEM* aFocusItem, bool aForce )
384{
385 std::string command = "$SELECT: ";
386
387 if( aFocusItem )
388 {
389 std::deque<EDA_ITEM*> focusItems = { aFocusItem };
390 std::set<wxString> focusParts;
391 collectItemsForSyncParts( focusItems, focusParts );
392
393 if( focusParts.size() > 0 )
394 {
395 command += "1,";
396 command += *focusParts.begin();
397 command += ",";
398 }
399 else
400 {
401 command += "0,";
402 }
403 }
404 else
405 {
406 command += "0,";
407 }
408
409 std::set<wxString> parts;
410 collectItemsForSyncParts( aItems, parts );
411
412 if( parts.empty() )
413 return;
414
415 for( wxString part : parts )
416 {
417 command += part;
418 command += ",";
419 }
420
421 command.pop_back();
422
423 if( Kiface().IsSingle() )
424 {
425 SendCommand( MSG_TO_SCH, command );
426 }
427 else
428 {
429 // Typically ExpressMail is going to be s-expression packets, but since
430 // we have existing interpreter of the selection packet on the other
431 // side in place, we use that here.
433 this );
434 }
435}
436
437
438void PCB_EDIT_FRAME::SendCrossProbeNetName( const wxString& aNetName )
439{
440 std::string packet = fmt::format( "$NET: \"{}\"", TO_UTF8( aNetName ) );
441
442 if( !packet.empty() )
443 {
444 if( Kiface().IsSingle() )
445 {
446 SendCommand( MSG_TO_SCH, packet );
447 }
448 else
449 {
450 // Typically ExpressMail is going to be s-expression packets, but since
451 // we have existing interpreter of the cross probe packet on the other
452 // side in place, we use that here.
453 Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this );
454 }
455 }
456}
457
458
460{
461 std::string packet = FormatProbeItem( aSyncItem );
462
463 if( !packet.empty() )
464 {
465 if( Kiface().IsSingle() )
466 {
467 SendCommand( MSG_TO_SCH, packet );
468 }
469 else
470 {
471 // Typically ExpressMail is going to be s-expression packets, but since
472 // we have existing interpreter of the cross probe packet on the other
473 // side in place, we use that here.
474 Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this );
475 }
476 }
477}
478
479
480std::vector<BOARD_ITEM*> PCB_EDIT_FRAME::FindItemsFromSyncSelection( std::string syncStr )
481{
482 wxArrayString syncArray = wxStringTokenize( syncStr, "," );
483
484 std::vector<std::pair<int, BOARD_ITEM*>> orderPairs;
485
486 for( FOOTPRINT* footprint : GetBoard()->Footprints() )
487 {
488 if( footprint == nullptr )
489 continue;
490
491 wxString fpSheetPath = footprint->GetPath().AsString().BeforeLast( '/' );
492 wxString fpUUID = footprint->m_Uuid.AsString();
493
494 if( fpSheetPath.IsEmpty() )
495 fpSheetPath += '/';
496
497 if( fpUUID.empty() )
498 continue;
499
500 wxString fpRefEscaped = EscapeString( footprint->GetReference(), CTX_IPC );
501
502 for( unsigned index = 0; index < syncArray.size(); ++index )
503 {
504 wxString syncEntry = syncArray[index];
505
506 if( syncEntry.empty() )
507 continue;
508
509 wxString syncData = syncEntry.substr( 1 );
510
511 switch( syncEntry.GetChar( 0 ).GetValue() )
512 {
513 case 'S': // Select sheet with subsheets: S<Sheet path>
514 if( fpSheetPath.StartsWith( syncData ) )
515 {
516 orderPairs.emplace_back( index, footprint );
517 }
518 break;
519 case 'F': // Select footprint: F<Reference>
520 if( syncData == fpRefEscaped )
521 {
522 orderPairs.emplace_back( index, footprint );
523 }
524 break;
525 case 'P': // Select pad: P<Footprint reference>/<Pad number>
526 {
527 if( syncData.StartsWith( fpRefEscaped ) )
528 {
529 wxString selectPadNumberEscaped =
530 syncData.substr( fpRefEscaped.size() + 1 ); // Skips the slash
531
532 wxString selectPadNumber = UnescapeString( selectPadNumberEscaped );
533
534 for( PAD* pad : footprint->Pads() )
535 {
536 if( selectPadNumber == pad->GetNumber() )
537 {
538 orderPairs.emplace_back( index, pad );
539 }
540 }
541 }
542 break;
543 }
544 default: break;
545 }
546 }
547 }
548
549 std::sort(
550 orderPairs.begin(), orderPairs.end(),
551 []( const std::pair<int, BOARD_ITEM*>& a, const std::pair<int, BOARD_ITEM*>& b ) -> bool
552 {
553 return a.first < b.first;
554 } );
555
556 std::vector<BOARD_ITEM*> items;
557 items.reserve( orderPairs.size() );
558
559 for( const std::pair<int, BOARD_ITEM*>& pair : orderPairs )
560 items.push_back( pair.second );
561
562 return items;
563}
564
565
567{
568 std::string& payload = mail.GetPayload();
569
570 switch( mail.Command() )
571 {
573 {
576
577 for( FOOTPRINT* footprint : GetBoard()->Footprints() )
578 {
579 if( footprint->GetAttributes() & FP_BOARD_ONLY )
580 continue; // Don't add board-only footprints to the netlist
581
582 COMPONENT* component = new COMPONENT( footprint->GetFPID(), footprint->GetReference(),
583 footprint->GetValue(), footprint->GetPath(), {} );
584
585 for( PAD* pad : footprint->Pads() )
586 {
587 const wxString& netname = pad->GetShortNetname();
588
589 if( !netname.IsEmpty() )
590 {
591 component->AddNet( pad->GetNumber(), netname, pad->GetPinFunction(),
592 pad->GetPinType() );
593 }
594 }
595
596 nlohmann::ordered_map<wxString, wxString> fields;
597
598 for( PCB_FIELD* field : footprint->GetFields() )
599 {
600 wxCHECK2( field, continue );
601
602 fields[field->GetCanonicalName()] = field->GetText();
603 }
604
605 component->SetFields( fields );
606
607 // Add DNP and Exclude from BOM properties
608 std::map<wxString, wxString> properties;
609
610 if( footprint->GetAttributes() & FP_DNP )
611 properties.emplace( "dnp", "" );
612
613 if( footprint->GetAttributes() & FP_EXCLUDE_FROM_BOM )
614 properties.emplace( "exclude_from_bom", "" );
615
616 component->SetProperties( properties );
617
618 netlist.AddComponent( component );
619 }
620
621 netlist.Format( "pcb_netlist", &sf, 0, CTL_OMIT_FILTERS );
622 payload = sf.GetString();
623 break;
624 }
625
627 try
628 {
630 FetchNetlistFromSchematic( netlist, wxEmptyString );
631
632 BOARD_NETLIST_UPDATER updater( this, GetBoard() );
633 updater.SetLookupByTimestamp( false );
634 updater.SetDeleteUnusedFootprints( false );
635 updater.SetReplaceFootprints( false );
636 updater.SetTransferGroups( false );
637 updater.UpdateNetlist( netlist );
638
639 bool dummy;
640 OnNetlistChanged( updater, &dummy );
641 }
642 catch( const IO_ERROR& )
643 {
644 assert( false ); // should never happen
645 return;
646 }
647
648 break;
649
650 case MAIL_CROSS_PROBE:
651 ExecuteRemoteCommand( payload.c_str() );
652 break;
653
654
655 case MAIL_SELECTION:
656 if( !GetPcbNewSettings()->m_CrossProbing.on_selection )
657 break;
658
660
662 {
663 // $SELECT: <mode 0 - only footprints, 1 - with connections>,<spec1>,<spec2>,<spec3>
664 std::string prefix = "$SELECT: ";
665
666 if( !payload.compare( 0, prefix.size(), prefix ) )
667 {
668 std::string del = ",";
669 std::string paramStr = payload.substr( prefix.size() );
670 size_t modeEnd = paramStr.find( del );
671 bool selectConnections = false;
672
673 try
674 {
675 if( std::stoi( paramStr.substr( 0, modeEnd ) ) == 1 )
676 selectConnections = true;
677 }
678 catch( std::invalid_argument& )
679 {
680 wxFAIL;
681 }
682
683 std::vector<BOARD_ITEM*> items =
684 FindItemsFromSyncSelection( paramStr.substr( modeEnd + 1 ) );
685
686 m_ProbingSchToPcb = true; // recursion guard
687
688 if( selectConnections )
690 else
692
693 // Update 3D viewer highlighting
694 Update3DView( false, GetPcbNewSettings()->m_Display.m_Live3DRefresh );
695
696 m_ProbingSchToPcb = false;
697
698 if( GetPcbNewSettings()->m_CrossProbing.flash_selection )
699 {
700 wxLogTrace( traceCrossProbeFlash, "MAIL_SELECTION(_FORCE) PCB: flash enabled, items=%zu", items.size() );
701 if( items.empty() )
702 {
703 wxLogTrace( traceCrossProbeFlash, "MAIL_SELECTION(_FORCE) PCB: nothing to flash" );
704 }
705 else
706 {
707 std::vector<BOARD_ITEM*> boardItems;
708 std::copy( items.begin(), items.end(), std::back_inserter( boardItems ) );
709 StartCrossProbeFlash( boardItems );
710 }
711 }
712 else
713 {
714 wxLogTrace( traceCrossProbeFlash, "MAIL_SELECTION(_FORCE) PCB: flash disabled" );
715 }
716 }
717
718 break;
719 }
720
721 case MAIL_PCB_UPDATE:
723 break;
724
725 case MAIL_IMPORT_FILE:
726 {
727 // Extract file format type and path (plugin type, path and properties keys, values separated with \n)
728 std::stringstream ss( payload );
729 char delim = '\n';
730
731 std::string formatStr;
732 wxCHECK( std::getline( ss, formatStr, delim ), /* void */ );
733
734 std::string fnameStr;
735 wxCHECK( std::getline( ss, fnameStr, delim ), /* void */ );
736 wxASSERT( !fnameStr.empty() );
737
738 int importFormat;
739
740 try
741 {
742 importFormat = std::stoi( formatStr );
743 }
744 catch( std::invalid_argument& )
745 {
746 wxFAIL;
747 importFormat = -1;
748 }
749
750 std::map<std::string, UTF8> props;
751
752 std::string key, value;
753 do
754 {
755 if( !std::getline( ss, key, delim ) )
756 break;
757
758 if( !std::getline( ss, value, delim ) )
759 break;
760
761 props.emplace( key, value );
762
763 } while( true );
764
765 if( importFormat >= 0 )
766 importFile( fnameStr, importFormat, props.empty() ? nullptr : &props );
767
768 break;
769 }
770
773 break;
774
775 case MAIL_RELOAD_LIB:
776 {
777 m_designBlocksPane->RefreshLibs();
778
779 // Show any footprint library load errors in the status bar
780 if( KISTATUSBAR* statusBar = dynamic_cast<KISTATUSBAR*>( GetStatusBar() ) )
781 {
783 wxString errors = adapter->GetLibraryLoadErrors();
784
785 if( !errors.IsEmpty() )
786 statusBar->AddWarningMessages( "load", errors );
787 }
788
789 break;
790 }
791
792 // many many others.
793 default:
794 ;
795 }
796}
797
int index
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
BOX2< VECTOR2I > BOX2I
Definition box2.h:922
static TOOL_ACTION updatePcbFromSchematic
Definition actions.h:264
static TOOL_ACTION pluginsReload
Definition actions.h:294
static TOOL_ACTION showFootprintLibTable
Definition actions.h:283
CROSS_PROBING_SETTINGS m_CrossProbing
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:84
FOOTPRINT * GetParentFootprint() const
Update the BOARD with a new netlist.
bool UpdateNetlist(NETLIST &aNetlist)
Update the board's components according to the new netlist.
void SetDeleteUnusedFootprints(bool aEnabled)
void SetReplaceFootprints(bool aEnabled)
void SetLookupByTimestamp(bool aEnabled)
void SetTransferGroups(bool aEnabled)
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:323
const NETINFO_LIST & GetNetInfo() const
Definition board.h:1004
const std::set< int > & GetHighLightNetCodes() const
Definition board.h:628
void SetHighLightNet(int aNetCode, bool aMulti=false)
Select the netcode to be highlighted.
Definition board.cpp:3553
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition board.cpp:2606
const ZONES & Zones() const
Definition board.h:368
void ResetNetHighLight()
Reset all high light data to the init state.
Definition board.cpp:3544
const FOOTPRINTS & Footprints() const
Definition board.h:364
const TRACKS & Tracks() const
Definition board.h:362
bool IsHighLightNetON() const
Definition board.h:644
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
Definition board.cpp:3568
constexpr size_type GetWidth() const
Definition box2.h:214
constexpr Vec Centre() const
Definition box2.h:97
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition box2.h:658
constexpr size_type GetHeight() const
Definition box2.h:215
Store all of the related component information found in a netlist.
void SetProperties(std::map< wxString, wxString > aProps)
void AddNet(const wxString &aPinName, const wxString &aNetName, const wxString &aPinFunction, const wxString &aPinType)
void SetFields(nlohmann::ordered_map< wxString, wxString > aFields)
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
void FocusOnLocation(const VECTOR2I &aPos, bool aAllowScroll=true)
Useful to focus on a particular location, in find functions.
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.
Definition eda_item.h:100
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:112
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition eda_text.h:114
An interface to the global shared library manager that is schematic-specific and linked to one projec...
const wxString & GetReference() const
Definition footprint.h:829
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
PCB specific render settings.
Definition pcb_painter.h:82
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
bool IsHighlightEnabled() const
Return current highlight setting.
void SetHighlight(bool aEnabled, int aNetcode=-1, bool aMulti=false)
Turns on/off highlighting.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:67
void UpdateAllLayersColor()
Apply the new coloring scheme to all layers.
Definition view.cpp:848
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition view.h:229
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition kiway_mail.h:38
std::string & GetPayload()
Return the payload, which can be any text but it typically self identifying s-expression.
Definition kiway_mail.h:56
MAIL_T Command()
Returns the MAIL_T associated with this mail.
Definition kiway_mail.h:48
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr, bool aFromOtherThread=false)
Send aPayload to aDestination from aSource.
Definition kiway.cpp:500
wxString GetLibraryLoadErrors() const
Returns all library load errors as newline-separated strings for display.
Handle the data for a net.
Definition netinfo.h:50
const wxString & GetNetChain() const
Definition netinfo.h:115
int GetNetCode() const
Definition netinfo.h:97
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Return the information about the NETINFO_ITEM in aList to display in the message panel.
Store information read from a netlist along with the flags used to update the NETLIST in the BOARD.
Definition pad.h:55
static TOOL_ACTION runDRC
static TOOL_ACTION syncSelection
Sets selection to specified items, zooms to fit, if enabled.
Definition pcb_actions.h:63
static TOOL_ACTION syncSelectionWithNets
Sets selection to specified items with connected nets, zooms to fit, if enabled.
Definition pcb_actions.h:66
PCBNEW_SETTINGS * GetPcbNewSettings() const
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
BOARD * GetBoard() const
virtual void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
void StartCrossProbeFlash(const std::vector< BOARD_ITEM * > &aItems)
void KiwayMailIn(KIWAY_MAIL_EVENT &aEvent) override
Receive #KIWAY_ROUTED_EVENT messages from other players.
void ShowBoardSetupDialog(const wxString &aInitialPage=wxEmptyString, wxWindow *aParent=nullptr)
void OnNetlistChanged(BOARD_NETLIST_UPDATER &aUpdater, bool *aRunDragCommand)
Called after netlist is updated.
void ExecuteRemoteCommand(const char *cmdline) override
Execute a remote command send by Eeschema via a socket, port KICAD_PCB_PORT_SERVICE_NUMBER (currently...
void SendCrossProbeItem(BOARD_ITEM *aSyncItem)
Send a message to the schematic editor so that it may move its cursor to an item with the same refere...
bool FetchNetlistFromSchematic(NETLIST &aNetlist, const wxString &aAnnotateMessage)
void SendSelectItemsToSch(const std::deque< EDA_ITEM * > &aItems, EDA_ITEM *aFocusItem, bool aForce)
Send a message to the schematic editor to try to find schematic counterparts of specified PCB items a...
std::vector< BOARD_ITEM * > FindItemsFromSyncSelection(std::string syncStr)
Used to find items by selection synchronization spec string.
PCB_DESIGN_BLOCK_PANE * m_designBlocksPane
bool importFile(const wxString &aFileName, int aFileType, const std::map< std::string, UTF8 > *aProperties=nullptr)
Load the given filename but sets the path to the current project path.
void SendCrossProbeNetName(const wxString &aNetName)
Send a net name to Eeschema for highlighting.
bool IsReference() const
Definition pcb_field.h:68
bool IsValue() const
Definition pcb_field.h:69
A set of BOARD_ITEMs (i.e., without duplicates).
Definition pcb_group.h:53
The selection tool: currently supports:
static FOOTPRINT_LIBRARY_ADAPTER * FootprintLibAdapter(PROJECT *aProject)
Implement an OUTPUTFORMATTER to a memory buffer.
Definition richio.h:422
const std::string & GetString()
Definition richio.h:445
TOOL_MANAGER * m_toolManager
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
bool RunAction(const std::string &aActionName, T aParam)
Run the specified action immediately, pausing the current action to run the new one.
Handle a list of polygons defining a copper zone.
Definition zone.h:74
#define CTL_OMIT_FILTERS
Omit the ki_fp_filters attribute in .kicad_xxx files.
Definition ctl_flags.h:41
#define _(s)
bool SendCommand(int aService, const std::string &aMessage)
Used by a client to sent (by a socket connection) a data to a server.
Definition eda_dde.cpp:230
DDE server & client.
#define MSG_TO_SCH
Definition eda_dde.h:50
@ FP_DNP
Definition footprint.h:91
@ FP_BOARD_ONLY
Definition footprint.h:89
@ FP_EXCLUDE_FROM_BOM
Definition footprint.h:88
@ FRAME_SCH
Definition frame_type.h:34
const wxChar *const traceCrossProbeFlash
Flag to enable debug output for cross-probe flash operations.
PROJECT & Prj()
Definition kicad.cpp:655
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
Definition macros.h:83
@ MAIL_PCB_UPDATE_LINKS
Definition mail_type.h:52
@ MAIL_IMPORT_FILE
Definition mail_type.h:48
@ MAIL_CROSS_PROBE
Definition mail_type.h:39
@ MAIL_PCB_UPDATE
Definition mail_type.h:46
@ MAIL_SELECTION_FORCE
Definition mail_type.h:41
@ MAIL_RELOAD_PLUGINS
Definition mail_type.h:58
@ MAIL_SELECTION
Definition mail_type.h:40
@ MAIL_RELOAD_LIB
Definition mail_type.h:57
@ MAIL_PCB_GET_NETLIST
Definition mail_type.h:51
Class to handle a set of BOARD_ITEMs.
void collectItemsForSyncParts(ItemContainer &aItems, std::set< wxString > &parts)
std::string FormatProbeItem(BOARD_ITEM *aItem)
KIWAY Kiway(KFCTL_STANDALONE)
std::vector< FAB_LAYER_COLOR > dummy
wxString UnescapeString(const wxString &aSource)
wxString From_UTF8(const char *cstring)
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
@ CTX_IPC
Cross-probing behavior.
bool zoom_to_fit
Zoom to fit items (ignored if center_on_items is off).
bool center_on_items
Automatically pan to cross-probed items.
bool auto_highlight
Automatically turn on highlight mode in the target frame.
wxLogTrace helper definitions.
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition typeinfo.h:108
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
Definition typeinfo.h:87
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition typeinfo.h:83
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition typeinfo.h:84