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 (C) 2019-2023 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
34#include <board.h>
36#include <footprint.h>
37#include <pad.h>
38#include <pcb_track.h>
39#include <pcb_group.h>
40#include <zone.h>
41#include <collectors.h>
42#include <eda_dde.h>
43#include <kiface_base.h>
44#include <kiway_express.h>
45#include <string_utils.h>
48#include <gal/painter.h>
49#include <pcb_edit_frame.h>
50#include <pcbnew_settings.h>
51#include <render_settings.h>
52#include <richio.h>
53#include <tool/tool_manager.h>
54#include <tools/pcb_actions.h>
57#include <wx/log.h>
58
59/* Execute a remote command sent via a socket on port KICAD_PCB_PORT_SERVICE_NUMBER
60 *
61 * Commands are:
62 *
63 * $NET: "net name" Highlight the given net
64 * $NETS: "net name 1,net name 2" Highlight all given nets
65 * $CLEAR Clear existing highlight
66 *
67 * $CONFIG Show the Manage Footprint Libraries dialog
68 * $CUSTOM_RULES Show the "Custom Rules" page of the Board Setup dialog
69 * $DRC Show the DRC dialog
70 */
71void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
72{
73 char line[1024];
74 wxString msg;
75 wxString modName;
76 char* idcmd;
77 char* text;
78 int netcode = -1;
79 bool multiHighlight = false;
80 FOOTPRINT* footprint = nullptr;
81 PAD* pad = nullptr;
82 BOARD* pcb = GetBoard();
83
85
87 KIGFX::RENDER_SETTINGS* renderSettings = view->GetPainter()->GetSettings();
88
89 strncpy( line, cmdline, sizeof(line) - 1 );
90 line[sizeof(line) - 1] = 0;
91
92 idcmd = strtok( line, " \n\r" );
93 text = strtok( nullptr, "\"\n\r" );
94
95 if( idcmd == nullptr )
96 return;
97
98 if( strcmp( idcmd, "$CONFIG" ) == 0 )
99 {
101 return;
102 }
103 else if( strcmp( idcmd, "$CUSTOM_RULES" ) == 0 )
104 {
105 ShowBoardSetupDialog( _( "Custom Rules" ) );
106 return;
107 }
108 else if( strcmp( idcmd, "$DRC" ) == 0 )
109 {
111 return;
112 }
113 else if( strcmp( idcmd, "$CLEAR" ) == 0 )
114 {
115 if( renderSettings->IsHighlightEnabled() )
116 {
117 renderSettings->SetHighlight( false );
118 view->UpdateAllLayersColor();
119 }
120
121 if( pcb->IsHighLightNetON() )
122 {
123 pcb->ResetNetHighLight();
124 SetMsgPanel( pcb );
125 }
126
127 GetCanvas()->Refresh();
128 return;
129 }
130 else if( strcmp( idcmd, "$NET:" ) == 0 )
131 {
132 if( !crossProbingSettings.auto_highlight )
133 return;
134
135 wxString net_name = From_UTF8( text );
136
137 NETINFO_ITEM* netinfo = pcb->FindNet( net_name );
138
139 if( netinfo )
140 {
141 netcode = netinfo->GetNetCode();
142
143 std::vector<MSG_PANEL_ITEM> items;
144 netinfo->GetMsgPanelInfo( this, items );
145 SetMsgPanel( items );
146 }
147
148 // fall through to highlighting section
149 }
150 else if( strcmp( idcmd, "$NETS:" ) == 0 )
151 {
152 if( !crossProbingSettings.auto_highlight )
153 return;
154
155 wxStringTokenizer netsTok = wxStringTokenizer( From_UTF8( text ), wxT( "," ) );
156 bool first = true;
157
158 while( netsTok.HasMoreTokens() )
159 {
160 NETINFO_ITEM* netinfo = pcb->FindNet( netsTok.GetNextToken() );
161
162 if( netinfo )
163 {
164 if( first )
165 {
166 // TODO: Once buses are included in netlist, show bus name
167 std::vector<MSG_PANEL_ITEM> items;
168 netinfo->GetMsgPanelInfo( this, items );
169 SetMsgPanel( items );
170 first = false;
171
172 pcb->SetHighLightNet( netinfo->GetNetCode() );
173 renderSettings->SetHighlight( true, netinfo->GetNetCode() );
174 multiHighlight = true;
175 }
176 else
177 {
178 pcb->SetHighLightNet( netinfo->GetNetCode(), true );
179 renderSettings->SetHighlight( true, netinfo->GetNetCode(), true );
180 }
181 }
182 }
183
184 netcode = -1;
185
186 // fall through to highlighting section
187 }
188
189 BOX2I bbox;
190
191 if( footprint )
192 {
193 bbox = footprint->GetBoundingBox( true );
194
195 if( pad )
197 else
199 }
200 else if( netcode > 0 || multiHighlight )
201 {
202 if( !multiHighlight )
203 {
204 renderSettings->SetHighlight( ( netcode >= 0 ), netcode );
205 pcb->SetHighLightNet( netcode );
206 }
207 else
208 {
209 // Just pick the first one for area calculation
210 netcode = *pcb->GetHighLightNetCodes().begin();
211 }
212
213 pcb->HighLightON();
214
215 auto merge_area =
216 [netcode, &bbox]( BOARD_CONNECTED_ITEM* aItem )
217 {
218 if( aItem->GetNetCode() == netcode )
219 bbox.Merge( aItem->GetBoundingBox() );
220 };
221
222 if( crossProbingSettings.center_on_items )
223 {
224 for( ZONE* zone : pcb->Zones() )
225 merge_area( zone );
226
227 for( PCB_TRACK* track : pcb->Tracks() )
228 merge_area( track );
229
230 for( FOOTPRINT* fp : pcb->Footprints() )
231 {
232 for( PAD* p : fp->Pads() )
233 merge_area( p );
234 }
235 }
236 }
237 else
238 {
239 renderSettings->SetHighlight( false );
240 }
241
242 if( crossProbingSettings.center_on_items && bbox.GetWidth() != 0 && bbox.GetHeight() != 0 )
243 {
244 if( crossProbingSettings.zoom_to_fit )
245 GetToolManager()->GetTool<PCB_SELECTION_TOOL>()->ZoomFitCrossProbeBBox( bbox );
246
247 FocusOnLocation( bbox.Centre() );
248 }
249
250 view->UpdateAllLayersColor();
251
252 // Ensure the display is refreshed, because in some installs the refresh is done only
253 // when the gal canvas has the focus, and that is not the case when crossprobing from
254 // Eeschema:
255 GetCanvas()->Refresh();
256}
257
258
259std::string FormatProbeItem( BOARD_ITEM* aItem )
260{
261 if( !aItem )
262 return "$CLEAR: \"HIGHLIGHTED\""; // message to clear highlight state
263
264 switch( aItem->Type() )
265 {
266 case PCB_FOOTPRINT_T:
267 {
268 FOOTPRINT* footprint = static_cast<FOOTPRINT*>( aItem );
269 return StrPrintf( "$PART: \"%s\"", TO_UTF8( footprint->GetReference() ) );
270 }
271
272 case PCB_PAD_T:
273 {
274 PAD* pad = static_cast<PAD*>( aItem );
275 FOOTPRINT* footprint = pad->GetParentFootprint();
276
277 return StrPrintf( "$PART: \"%s\" $PAD: \"%s\"",
278 TO_UTF8( footprint->GetReference() ),
279 TO_UTF8( pad->GetNumber() ) );
280 }
281
282 case PCB_FIELD_T:
283 {
284 PCB_FIELD* field = static_cast<PCB_FIELD*>( aItem );
285 FOOTPRINT* footprint = field->GetParentFootprint();
286 const char* text_key;
287
288 /* This can't be a switch since the break need to pull out
289 * from the outer switch! */
290 if( field->IsReference() )
291 text_key = "$REF:";
292 else if( field->IsValue() )
293 text_key = "$VAL:";
294 else
295 break;
296
297 return StrPrintf( "$PART: \"%s\" %s \"%s\"",
298 TO_UTF8( footprint->GetReference() ),
299 text_key,
300 TO_UTF8( field->GetText() ) );
301 }
302
303 default:
304 break;
305 }
306
307 return "";
308}
309
310
311template <typename ItemContainer>
312void collectItemsForSyncParts( ItemContainer& aItems, std::set<wxString>& parts )
313{
314 for( EDA_ITEM* item : aItems )
315 {
316 switch( item->Type() )
317 {
318 case PCB_GROUP_T:
319 {
320 PCB_GROUP* group = static_cast<PCB_GROUP*>( item );
321
322 collectItemsForSyncParts( group->GetItems(), parts );
323
324 break;
325 }
326 case PCB_FOOTPRINT_T:
327 {
328 FOOTPRINT* footprint = static_cast<FOOTPRINT*>( item );
329 wxString ref = footprint->GetReference();
330
331 parts.emplace( wxT( "F" ) + EscapeString( ref, CTX_IPC ) );
332
333 break;
334 }
335
336 case PCB_PAD_T:
337 {
338 PAD* pad = static_cast<PAD*>( item );
339 wxString ref = pad->GetParentFootprint()->GetReference();
340
341 parts.emplace( wxT( "P" ) + EscapeString( ref, CTX_IPC ) + wxT( "/" )
342 + EscapeString( pad->GetNumber(), CTX_IPC ) );
343
344 break;
345 }
346
347 default: break;
348 }
349 }
350}
351
352
353void PCB_EDIT_FRAME::SendSelectItemsToSch( const std::deque<EDA_ITEM*>& aItems,
354 EDA_ITEM* aFocusItem, bool aForce )
355{
356 std::string command = "$SELECT: ";
357
358 if( aFocusItem )
359 {
360 std::deque<EDA_ITEM*> focusItems = { aFocusItem };
361 std::set<wxString> focusParts;
362 collectItemsForSyncParts( focusItems, focusParts );
363
364 if( focusParts.size() > 0 )
365 {
366 command += "1,";
367 command += *focusParts.begin();
368 command += ",";
369 }
370 else
371 {
372 command += "0,";
373 }
374 }
375 else
376 {
377 command += "0,";
378 }
379
380 std::set<wxString> parts;
381 collectItemsForSyncParts( aItems, parts );
382
383 if( parts.empty() )
384 return;
385
386 for( wxString part : parts )
387 {
388 command += part;
389 command += ",";
390 }
391
392 command.pop_back();
393
394 if( Kiface().IsSingle() )
395 {
396 SendCommand( MSG_TO_SCH, command );
397 }
398 else
399 {
400 // Typically ExpressMail is going to be s-expression packets, but since
401 // we have existing interpreter of the selection packet on the other
402 // side in place, we use that here.
404 this );
405 }
406}
407
408
409void PCB_EDIT_FRAME::SendCrossProbeNetName( const wxString& aNetName )
410{
411 std::string packet = StrPrintf( "$NET: \"%s\"", TO_UTF8( aNetName ) );
412
413 if( !packet.empty() )
414 {
415 if( Kiface().IsSingle() )
416 {
417 SendCommand( MSG_TO_SCH, packet );
418 }
419 else
420 {
421 // Typically ExpressMail is going to be s-expression packets, but since
422 // we have existing interpreter of the cross probe packet on the other
423 // side in place, we use that here.
424 Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this );
425 }
426 }
427}
428
429
431{
432 std::string packet = FormatProbeItem( aSyncItem );
433
434 if( !packet.empty() )
435 {
436 if( Kiface().IsSingle() )
437 {
438 SendCommand( MSG_TO_SCH, packet );
439 }
440 else
441 {
442 // Typically ExpressMail is going to be s-expression packets, but since
443 // we have existing interpreter of the cross probe packet on the other
444 // side in place, we use that here.
445 Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this );
446 }
447 }
448}
449
450
451std::vector<BOARD_ITEM*> PCB_EDIT_FRAME::FindItemsFromSyncSelection( std::string syncStr )
452{
453 wxArrayString syncArray = wxStringTokenize( syncStr, "," );
454
455 std::vector<std::pair<int, BOARD_ITEM*>> orderPairs;
456
457 for( FOOTPRINT* footprint : GetBoard()->Footprints() )
458 {
459 if( footprint == nullptr )
460 continue;
461
462 wxString fpSheetPath = footprint->GetPath().AsString().BeforeLast( '/' );
463 wxString fpUUID = footprint->m_Uuid.AsString();
464
465 if( fpSheetPath.IsEmpty() )
466 fpSheetPath += '/';
467
468 if( fpUUID.empty() )
469 continue;
470
471 wxString fpRefEscaped = EscapeString( footprint->GetReference(), CTX_IPC );
472
473 for( unsigned index = 0; index < syncArray.size(); ++index )
474 {
475 wxString syncEntry = syncArray[index];
476
477 if( syncEntry.empty() )
478 continue;
479
480 wxString syncData = syncEntry.substr( 1 );
481
482 switch( syncEntry.GetChar( 0 ).GetValue() )
483 {
484 case 'S': // Select sheet with subsheets: S<Sheet path>
485 if( fpSheetPath.StartsWith( syncData ) )
486 {
487 orderPairs.emplace_back( index, footprint );
488 }
489 break;
490 case 'F': // Select footprint: F<Reference>
491 if( syncData == fpRefEscaped )
492 {
493 orderPairs.emplace_back( index, footprint );
494 }
495 break;
496 case 'P': // Select pad: P<Footprint reference>/<Pad number>
497 {
498 if( syncData.StartsWith( fpRefEscaped ) )
499 {
500 wxString selectPadNumberEscaped =
501 syncData.substr( fpRefEscaped.size() + 1 ); // Skips the slash
502
503 wxString selectPadNumber = UnescapeString( selectPadNumberEscaped );
504
505 for( PAD* pad : footprint->Pads() )
506 {
507 if( selectPadNumber == pad->GetNumber() )
508 {
509 orderPairs.emplace_back( index, pad );
510 }
511 }
512 }
513 break;
514 }
515 default: break;
516 }
517 }
518 }
519
520 std::sort(
521 orderPairs.begin(), orderPairs.end(),
522 []( const std::pair<int, BOARD_ITEM*>& a, const std::pair<int, BOARD_ITEM*>& b ) -> bool
523 {
524 return a.first < b.first;
525 } );
526
527 std::vector<BOARD_ITEM*> items;
528 items.reserve( orderPairs.size() );
529
530 for( const std::pair<int, BOARD_ITEM*>& pair : orderPairs )
531 items.push_back( pair.second );
532
533 return items;
534}
535
536
538{
539 std::string& payload = mail.GetPayload();
540
541 switch( mail.Command() )
542 {
544 {
547
548 for( FOOTPRINT* footprint : GetBoard()->Footprints() )
549 {
550 if( footprint->GetAttributes() & FP_BOARD_ONLY )
551 continue; // Don't add board-only footprints to the netlist
552
553 COMPONENT* component = new COMPONENT( footprint->GetFPID(), footprint->GetReference(),
554 footprint->GetValue(), footprint->GetPath(), {} );
555
556 for( PAD* pad : footprint->Pads() )
557 {
558 const wxString& netname = pad->GetShortNetname();
559
560 if( !netname.IsEmpty() )
561 {
562 component->AddNet( pad->GetNumber(), netname, pad->GetPinFunction(),
563 pad->GetPinType() );
564 }
565 }
566
567 nlohmann::ordered_map<wxString, wxString> fields;
568 for( PCB_FIELD* field : footprint->Fields() )
569 fields[field->GetCanonicalName()] = field->GetText();
570
571 component->SetFields( fields );
572
573 // Add DNP and Exclude from BOM properties
574 std::map<wxString, wxString> properties;
575
576 if( footprint->GetAttributes() & FP_DNP )
577 properties.emplace( "dnp", "" );
578
579 if( footprint->GetAttributes() & FP_EXCLUDE_FROM_BOM )
580 properties.emplace( "exclude_from_bom", "" );
581
582 component->SetProperties( properties );
583
584 netlist.AddComponent( component );
585 }
586
587 netlist.Format( "pcb_netlist", &sf, 0, CTL_OMIT_FILTERS );
588 payload = sf.GetString();
589 break;
590 }
591
593 try
594 {
596 FetchNetlistFromSchematic( netlist, wxEmptyString );
597
598 BOARD_NETLIST_UPDATER updater( this, GetBoard() );
599 updater.SetLookupByTimestamp( false );
600 updater.SetDeleteUnusedFootprints( false );
601 updater.SetReplaceFootprints( false );
602 updater.UpdateNetlist( netlist );
603
604 bool dummy;
605 OnNetlistChanged( updater, &dummy );
606 }
607 catch( const IO_ERROR& )
608 {
609 assert( false ); // should never happen
610 return;
611 }
612
613 break;
614
615 case MAIL_CROSS_PROBE:
616 ExecuteRemoteCommand( payload.c_str() );
617 break;
618
619
620 case MAIL_SELECTION:
621 if( !GetPcbNewSettings()->m_CrossProbing.on_selection )
622 break;
623
625
627 {
628 // $SELECT: <mode 0 - only footprints, 1 - with connections>,<spec1>,<spec2>,<spec3>
629 std::string prefix = "$SELECT: ";
630
631 if( !payload.compare( 0, prefix.size(), prefix ) )
632 {
633 std::string del = ",";
634 std::string paramStr = payload.substr( prefix.size() );
635 size_t modeEnd = paramStr.find( del );
636 bool selectConnections = false;
637
638 try
639 {
640 if( std::stoi( paramStr.substr( 0, modeEnd ) ) == 1 )
641 selectConnections = true;
642 }
643 catch( std::invalid_argument& )
644 {
645 wxFAIL;
646 }
647
648 std::vector<BOARD_ITEM*> items =
649 FindItemsFromSyncSelection( paramStr.substr( modeEnd + 1 ) );
650
651 m_probingSchToPcb = true; // recursion guard
652
653 if( selectConnections )
655 else
657
658 // Update 3D viewer highlighting
659 Update3DView( false, GetPcbNewSettings()->m_Display.m_Live3DRefresh );
660
661 m_probingSchToPcb = false;
662 }
663
664 break;
665 }
666
667 case MAIL_PCB_UPDATE:
669 break;
670
671 case MAIL_IMPORT_FILE:
672 {
673 // Extract file format type and path (plugin type, path and properties keys, values separated with \n)
674 std::stringstream ss( payload );
675 char delim = '\n';
676
677 std::string formatStr;
678 wxCHECK( std::getline( ss, formatStr, delim ), /* void */ );
679
680 std::string fnameStr;
681 wxCHECK( std::getline( ss, fnameStr, delim ), /* void */ );
682 wxASSERT( !fnameStr.empty() );
683
684 int importFormat;
685
686 try
687 {
688 importFormat = std::stoi( formatStr );
689 }
690 catch( std::invalid_argument& )
691 {
692 wxFAIL;
693 importFormat = -1;
694 }
695
696 std::map<std::string, UTF8> props;
697
698 std::string key, value;
699 do
700 {
701 if( !std::getline( ss, key, delim ) )
702 break;
703
704 if( !std::getline( ss, value, delim ) )
705 break;
706
707 props.emplace( key, value );
708
709 } while( true );
710
711 if( importFormat >= 0 )
712 importFile( fnameStr, importFormat, props.empty() ? nullptr : &props );
713
714 break;
715 }
716
719 break;
720
721 // many many others.
722 default:
723 ;
724 }
725}
726
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
static TOOL_ACTION updatePcbFromSchematic
Definition: actions.h:214
static TOOL_ACTION pluginsReload
Definition: actions.h:241
static TOOL_ACTION showFootprintLibTable
Definition: actions.h:230
CROSS_PROBING_SETTINGS m_CrossProbing
Definition: app_settings.h:170
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:79
FOOTPRINT * GetParentFootprint() const
Definition: board_item.cpp:298
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)
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:290
const std::set< int > & GetHighLightNetCodes() const
Definition: board.h:532
void SetHighLightNet(int aNetCode, bool aMulti=false)
Select the netcode to be highlighted.
Definition: board.cpp:2729
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:1921
const ZONES & Zones() const
Definition: board.h:335
void ResetNetHighLight()
Reset all high light data to the init state.
Definition: board.cpp:2720
const FOOTPRINTS & Footprints() const
Definition: board.h:331
const TRACKS & Tracks() const
Definition: board.h:329
bool IsHighLightNetON() const
Definition: board.h:548
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
Definition: board.cpp:2742
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 footprint information found in a netlist.
Definition: pcb_netlist.h:88
void SetFields(nlohmann::ordered_map< wxString, wxString > &aFields)
Definition: pcb_netlist.h:134
void SetProperties(std::map< wxString, wxString > &aProps)
Definition: pcb_netlist.h:140
void AddNet(const wxString &aPinName, const wxString &aNetName, const wxString &aPinFunction, const wxString &aPinType)
Definition: pcb_netlist.h:106
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)
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:89
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:101
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition: eda_text.h:98
const wxString & GetReference() const
Definition: footprint.h:602
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: footprint.cpp:1294
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:77
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.
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:68
void UpdateAllLayersColor()
Apply the new coloring scheme to all layers.
Definition: view.cpp:765
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:217
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition: kiway_express.h:40
std::string & GetPayload()
Return the payload, which can be any text but it typically self identifying s-expression.
Definition: kiway_express.h:58
MAIL_T Command()
Returns the MAIL_T associated with this mail.
Definition: kiway_express.h:50
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr)
Send aPayload to aDestination from aSource.
Definition: kiway.cpp:527
Handle the data for a net.
Definition: netinfo.h:56
int GetNetCode() const
Definition: netinfo.h:108
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: pcb_netlist.h:241
Definition: pad.h:54
static TOOL_ACTION highlightItem
Definition: pcb_actions.h:562
static TOOL_ACTION runDRC
Definition: pcb_actions.h:449
static TOOL_ACTION syncSelection
Sets selection to specified items, zooms to fit, if enabled.
Definition: pcb_actions.h:80
static TOOL_ACTION syncSelectionWithNets
Sets selection to specified items with connected nets, zooms to fit, if enabled.
Definition: pcb_actions.h:83
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 ShowBoardSetupDialog(const wxString &aInitialPage=wxEmptyString)
void KiwayMailIn(KIWAY_EXPRESS &aEvent) override
Receive KIWAY_EXPRESS messages from other players.
void OnNetlistChanged(BOARD_NETLIST_UPDATER &aUpdater, bool *aRunDragCommand)
Called after netlist is updated.
Definition: netlist.cpp:87
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.
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:52
The selection tool: currently supports:
Implement an OUTPUTFORMATTER to a memory buffer.
Definition: richio.h:449
const std::string & GetString()
Definition: richio.h:472
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:167
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:55
bool RunAction(const std::string &aActionName, T aParam)
Run the specified action immediately, pausing the current action to run the new one.
Definition: tool_manager.h:150
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:391
Handle a list of polygons defining a copper zone.
Definition: zone.h:73
#define CTL_OMIT_FILTERS
Omit the ki_fp_filters attribute in .kicad_xxx files.
Definition: ctl_flags.h:43
#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:310
DDE server & client.
#define MSG_TO_SCH
Definition: eda_dde.h:50
@ FP_DNP
Definition: footprint.h:83
@ FP_BOARD_ONLY
Definition: footprint.h:79
@ FP_EXCLUDE_FROM_BOM
Definition: footprint.h:78
@ FRAME_SCH
Definition: frame_type.h:34
#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:57
@ MAIL_SELECTION
Definition: mail_type.h:40
@ 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)
int StrPrintf(std::string *result, const char *format,...)
This is like sprintf() but the output is appended to a std::string instead of to a character array.
Definition: richio.cpp:68
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.
Definition: string_utils.h:398
@ CTX_IPC
Definition: string_utils.h:56
Cross-probing behavior.
Definition: app_settings.h:32
bool zoom_to_fit
Zoom to fit items (ignored if center_on_items is off)
Definition: app_settings.h:35
bool center_on_items
Automatically pan to cross-probed items.
Definition: app_settings.h:34
bool auto_highlight
Automatically turn on highlight mode in the target frame.
Definition: app_settings.h:36
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:110
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
Definition: typeinfo.h:90
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition: typeinfo.h:86
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition: typeinfo.h:87