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_edit_frame.h>
52#include <pcbnew_settings.h>
53#include <render_settings.h>
54#include <richio.h>
55#include <tool/tool_manager.h>
56#include <tools/pcb_actions.h>
58#include <trace_helpers.h>
61#include <widgets/kistatusbar.h>
62#include <project_pcb.h>
64#include <wx/log.h>
65
66/* Execute a remote command sent via a socket on port KICAD_PCB_PORT_SERVICE_NUMBER
67 *
68 * Commands are:
69 *
70 * $NET: "net name" Highlight the given net
71 * $NETS: "net name 1,net name 2" Highlight all given nets
72 * $CLEAR Clear existing highlight
73 *
74 * $CONFIG Show the Manage Footprint Libraries dialog
75 * $CUSTOM_RULES Show the "Custom Rules" page of the Board Setup dialog
76 * $DRC Show the DRC dialog
77 */
78void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
79{
80 char line[1024];
81 char* idcmd;
82 char* text;
83 int netcode = -1;
84 bool multiHighlight = false;
85 BOARD* pcb = GetBoard();
86
88
89 KIGFX::VIEW* view = m_toolManager->GetView();
90 KIGFX::RENDER_SETTINGS* renderSettings = view->GetPainter()->GetSettings();
91
92 strncpy( line, cmdline, sizeof(line) - 1 );
93 line[sizeof(line) - 1] = 0;
94
95 idcmd = strtok( line, " \n\r" );
96 text = strtok( nullptr, "\"\n\r" );
97
98 if( idcmd == nullptr )
99 return;
100
101 if( strcmp( idcmd, "$CONFIG" ) == 0 )
102 {
104 return;
105 }
106 else if( strcmp( idcmd, "$CUSTOM_RULES" ) == 0 )
107 {
108 ShowBoardSetupDialog( _( "Custom Rules" ) );
109 return;
110 }
111 else if( strcmp( idcmd, "$DRC" ) == 0 )
112 {
114 return;
115 }
116 else if( strcmp( idcmd, "$CLEAR" ) == 0 )
117 {
118 if( renderSettings->IsHighlightEnabled() )
119 {
120 renderSettings->SetHighlight( false );
121 view->UpdateAllLayersColor();
122 }
123
124 if( pcb->IsHighLightNetON() )
125 {
126 pcb->ResetNetHighLight();
127 SetMsgPanel( pcb );
128 }
129
130 GetCanvas()->Refresh();
131 return;
132 }
133 else if( strcmp( idcmd, "$NET:" ) == 0 )
134 {
135 if( !crossProbingSettings.auto_highlight )
136 return;
137
138 wxString net_name = From_UTF8( text );
139
140 NETINFO_ITEM* netinfo = pcb->FindNet( net_name );
141
142 if( netinfo )
143 {
144 netcode = netinfo->GetNetCode();
145
146 std::vector<MSG_PANEL_ITEM> items;
147 netinfo->GetMsgPanelInfo( this, items );
148 SetMsgPanel( items );
149 }
150
151 // fall through to highlighting section
152 }
153 else if( strcmp( idcmd, "$NETS:" ) == 0 )
154 {
155 if( !crossProbingSettings.auto_highlight )
156 return;
157
158 wxStringTokenizer netsTok = wxStringTokenizer( From_UTF8( text ), ",", wxTOKEN_STRTOK );
159 bool first = true;
160
161 while( netsTok.HasMoreTokens() )
162 {
163 NETINFO_ITEM* netinfo = pcb->FindNet( netsTok.GetNextToken().Trim( true ).Trim( false ) );
164
165 if( netinfo )
166 {
167 if( first )
168 {
169 // TODO: Once buses are included in netlist, show bus name
170 std::vector<MSG_PANEL_ITEM> items;
171 netinfo->GetMsgPanelInfo( this, items );
172 SetMsgPanel( items );
173 first = false;
174
175 pcb->SetHighLightNet( netinfo->GetNetCode() );
176 renderSettings->SetHighlight( true, netinfo->GetNetCode() );
177 multiHighlight = true;
178 }
179 else
180 {
181 pcb->SetHighLightNet( netinfo->GetNetCode(), true );
182 renderSettings->SetHighlight( true, netinfo->GetNetCode(), true );
183 }
184 }
185 }
186
187 netcode = -1;
188
189 // fall through to highlighting section
190 }
191
192 BOX2I bbox;
193
194 if( netcode > 0 || multiHighlight )
195 {
196 if( !multiHighlight )
197 {
198 renderSettings->SetHighlight( ( netcode >= 0 ), netcode );
199 pcb->SetHighLightNet( netcode );
200 }
201 else
202 {
203 // Just pick the first one for area calculation
204 netcode = *pcb->GetHighLightNetCodes().begin();
205 }
206
207 pcb->HighLightON();
208
209 auto merge_area =
210 [netcode, &bbox]( BOARD_CONNECTED_ITEM* aItem )
211 {
212 if( aItem->GetNetCode() == netcode )
213 bbox.Merge( aItem->GetBoundingBox() );
214 };
215
216 if( crossProbingSettings.center_on_items )
217 {
218 for( ZONE* zone : pcb->Zones() )
219 merge_area( zone );
220
221 for( PCB_TRACK* track : pcb->Tracks() )
222 merge_area( track );
223
224 for( FOOTPRINT* fp : pcb->Footprints() )
225 {
226 for( PAD* p : fp->Pads() )
227 merge_area( p );
228 }
229 }
230 }
231 else
232 {
233 renderSettings->SetHighlight( false );
234 }
235
236 if( crossProbingSettings.center_on_items && bbox.GetWidth() != 0 && bbox.GetHeight() != 0 )
237 {
238 if( crossProbingSettings.zoom_to_fit )
239 GetToolManager()->GetTool<PCB_SELECTION_TOOL>()->ZoomFitCrossProbeBBox( bbox );
240
241 FocusOnLocation( bbox.Centre() );
242 }
243
244 view->UpdateAllLayersColor();
245
246 // Ensure the display is refreshed, because in some installs the refresh is done only
247 // when the gal canvas has the focus, and that is not the case when crossprobing from
248 // Eeschema:
249 GetCanvas()->Refresh();
250}
251
252
253std::string FormatProbeItem( BOARD_ITEM* aItem )
254{
255 if( !aItem )
256 return "$CLEAR: \"HIGHLIGHTED\""; // message to clear highlight state
257
258 switch( aItem->Type() )
259 {
260 case PCB_FOOTPRINT_T:
261 {
262 FOOTPRINT* footprint = static_cast<FOOTPRINT*>( aItem );
263 return fmt::format( "$PART: \"{}\"", TO_UTF8( footprint->GetReference() ) );
264 }
265
266 case PCB_PAD_T:
267 {
268 PAD* pad = static_cast<PAD*>( aItem );
269 FOOTPRINT* footprint = pad->GetParentFootprint();
270
271 return fmt::format( "$PART: \"{}\" $PAD: \"{}\"",
272 TO_UTF8( footprint->GetReference() ),
273 TO_UTF8( pad->GetNumber() ) );
274 }
275
276 case PCB_FIELD_T:
277 {
278 PCB_FIELD* field = static_cast<PCB_FIELD*>( aItem );
279 FOOTPRINT* footprint = field->GetParentFootprint();
280 const char* text_key;
281
282 /* This can't be a switch since the break need to pull out
283 * from the outer switch! */
284 if( field->IsReference() )
285 text_key = "$REF:";
286 else if( field->IsValue() )
287 text_key = "$VAL:";
288 else
289 break;
290
291 return fmt::format( "$PART: \"{}\" {} \"{}\"",
292 TO_UTF8( footprint->GetReference() ),
293 text_key,
294 TO_UTF8( field->GetText() ) );
295 }
296
297 default:
298 break;
299 }
300
301 return "";
302}
303
304
305template <typename ItemContainer>
306void collectItemsForSyncParts( ItemContainer& aItems, std::set<wxString>& parts )
307{
308 for( EDA_ITEM* item : aItems )
309 {
310 switch( item->Type() )
311 {
312 case PCB_GROUP_T:
313 {
314 PCB_GROUP* group = static_cast<PCB_GROUP*>( item );
315
316 collectItemsForSyncParts( group->GetItems(), parts );
317 break;
318 }
319 case PCB_FOOTPRINT_T:
320 {
321 FOOTPRINT* footprint = static_cast<FOOTPRINT*>( item );
322 wxString ref = footprint->GetReference();
323
324 parts.emplace( wxT( "F" ) + EscapeString( ref, CTX_IPC ) );
325 break;
326 }
327
328 case PCB_PAD_T:
329 {
330 PAD* pad = static_cast<PAD*>( item );
331 wxString ref = pad->GetParentFootprint()->GetReference();
332
333 parts.emplace( wxT( "P" ) + EscapeString( ref, CTX_IPC ) + wxT( "/" )
334 + EscapeString( pad->GetNumber(), CTX_IPC ) );
335 break;
336 }
337
338 default: break;
339 }
340 }
341}
342
343
344void PCB_EDIT_FRAME::SendSelectItemsToSch( const std::deque<EDA_ITEM*>& aItems,
345 EDA_ITEM* aFocusItem, bool aForce )
346{
347 std::string command = "$SELECT: ";
348
349 if( aFocusItem )
350 {
351 std::deque<EDA_ITEM*> focusItems = { aFocusItem };
352 std::set<wxString> focusParts;
353 collectItemsForSyncParts( focusItems, focusParts );
354
355 if( focusParts.size() > 0 )
356 {
357 command += "1,";
358 command += *focusParts.begin();
359 command += ",";
360 }
361 else
362 {
363 command += "0,";
364 }
365 }
366 else
367 {
368 command += "0,";
369 }
370
371 std::set<wxString> parts;
372 collectItemsForSyncParts( aItems, parts );
373
374 if( parts.empty() )
375 return;
376
377 for( wxString part : parts )
378 {
379 command += part;
380 command += ",";
381 }
382
383 command.pop_back();
384
385 if( Kiface().IsSingle() )
386 {
387 SendCommand( MSG_TO_SCH, command );
388 }
389 else
390 {
391 // Typically ExpressMail is going to be s-expression packets, but since
392 // we have existing interpreter of the selection packet on the other
393 // side in place, we use that here.
395 this );
396 }
397}
398
399
400void PCB_EDIT_FRAME::SendCrossProbeNetName( const wxString& aNetName )
401{
402 std::string packet = fmt::format( "$NET: \"{}\"", TO_UTF8( aNetName ) );
403
404 if( !packet.empty() )
405 {
406 if( Kiface().IsSingle() )
407 {
408 SendCommand( MSG_TO_SCH, packet );
409 }
410 else
411 {
412 // Typically ExpressMail is going to be s-expression packets, but since
413 // we have existing interpreter of the cross probe packet on the other
414 // side in place, we use that here.
415 Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this );
416 }
417 }
418}
419
420
422{
423 std::string packet = FormatProbeItem( aSyncItem );
424
425 if( !packet.empty() )
426 {
427 if( Kiface().IsSingle() )
428 {
429 SendCommand( MSG_TO_SCH, packet );
430 }
431 else
432 {
433 // Typically ExpressMail is going to be s-expression packets, but since
434 // we have existing interpreter of the cross probe packet on the other
435 // side in place, we use that here.
436 Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this );
437 }
438 }
439}
440
441
442std::vector<BOARD_ITEM*> PCB_EDIT_FRAME::FindItemsFromSyncSelection( std::string syncStr )
443{
444 wxArrayString syncArray = wxStringTokenize( syncStr, "," );
445
446 std::vector<std::pair<int, BOARD_ITEM*>> orderPairs;
447
448 for( FOOTPRINT* footprint : GetBoard()->Footprints() )
449 {
450 if( footprint == nullptr )
451 continue;
452
453 wxString fpSheetPath = footprint->GetPath().AsString().BeforeLast( '/' );
454 wxString fpUUID = footprint->m_Uuid.AsString();
455
456 if( fpSheetPath.IsEmpty() )
457 fpSheetPath += '/';
458
459 if( fpUUID.empty() )
460 continue;
461
462 wxString fpRefEscaped = EscapeString( footprint->GetReference(), CTX_IPC );
463
464 for( unsigned index = 0; index < syncArray.size(); ++index )
465 {
466 wxString syncEntry = syncArray[index];
467
468 if( syncEntry.empty() )
469 continue;
470
471 wxString syncData = syncEntry.substr( 1 );
472
473 switch( syncEntry.GetChar( 0 ).GetValue() )
474 {
475 case 'S': // Select sheet with subsheets: S<Sheet path>
476 if( fpSheetPath.StartsWith( syncData ) )
477 {
478 orderPairs.emplace_back( index, footprint );
479 }
480 break;
481 case 'F': // Select footprint: F<Reference>
482 if( syncData == fpRefEscaped )
483 {
484 orderPairs.emplace_back( index, footprint );
485 }
486 break;
487 case 'P': // Select pad: P<Footprint reference>/<Pad number>
488 {
489 if( syncData.StartsWith( fpRefEscaped ) )
490 {
491 wxString selectPadNumberEscaped =
492 syncData.substr( fpRefEscaped.size() + 1 ); // Skips the slash
493
494 wxString selectPadNumber = UnescapeString( selectPadNumberEscaped );
495
496 for( PAD* pad : footprint->Pads() )
497 {
498 if( selectPadNumber == pad->GetNumber() )
499 {
500 orderPairs.emplace_back( index, pad );
501 }
502 }
503 }
504 break;
505 }
506 default: break;
507 }
508 }
509 }
510
511 std::sort(
512 orderPairs.begin(), orderPairs.end(),
513 []( const std::pair<int, BOARD_ITEM*>& a, const std::pair<int, BOARD_ITEM*>& b ) -> bool
514 {
515 return a.first < b.first;
516 } );
517
518 std::vector<BOARD_ITEM*> items;
519 items.reserve( orderPairs.size() );
520
521 for( const std::pair<int, BOARD_ITEM*>& pair : orderPairs )
522 items.push_back( pair.second );
523
524 return items;
525}
526
527
529{
530 std::string& payload = mail.GetPayload();
531
532 switch( mail.Command() )
533 {
535 {
538
539 for( FOOTPRINT* footprint : GetBoard()->Footprints() )
540 {
541 if( footprint->GetAttributes() & FP_BOARD_ONLY )
542 continue; // Don't add board-only footprints to the netlist
543
544 COMPONENT* component = new COMPONENT( footprint->GetFPID(), footprint->GetReference(),
545 footprint->GetValue(), footprint->GetPath(), {} );
546
547 for( PAD* pad : footprint->Pads() )
548 {
549 const wxString& netname = pad->GetShortNetname();
550
551 if( !netname.IsEmpty() )
552 {
553 component->AddNet( pad->GetNumber(), netname, pad->GetPinFunction(),
554 pad->GetPinType() );
555 }
556 }
557
558 nlohmann::ordered_map<wxString, wxString> fields;
559
560 for( PCB_FIELD* field : footprint->GetFields() )
561 {
562 wxCHECK2( field, continue );
563
564 fields[field->GetCanonicalName()] = field->GetText();
565 }
566
567 component->SetFields( fields );
568
569 // Add DNP and Exclude from BOM properties
570 std::map<wxString, wxString> properties;
571
572 if( footprint->GetAttributes() & FP_DNP )
573 properties.emplace( "dnp", "" );
574
575 if( footprint->GetAttributes() & FP_EXCLUDE_FROM_BOM )
576 properties.emplace( "exclude_from_bom", "" );
577
578 component->SetProperties( properties );
579
580 netlist.AddComponent( component );
581 }
582
583 netlist.Format( "pcb_netlist", &sf, 0, CTL_OMIT_FILTERS );
584 payload = sf.GetString();
585 break;
586 }
587
589 try
590 {
592 FetchNetlistFromSchematic( netlist, wxEmptyString );
593
594 BOARD_NETLIST_UPDATER updater( this, GetBoard() );
595 updater.SetLookupByTimestamp( false );
596 updater.SetDeleteUnusedFootprints( false );
597 updater.SetReplaceFootprints( false );
598 updater.SetTransferGroups( false );
599 updater.UpdateNetlist( netlist );
600
601 bool dummy;
602 OnNetlistChanged( updater, &dummy );
603 }
604 catch( const IO_ERROR& )
605 {
606 assert( false ); // should never happen
607 return;
608 }
609
610 break;
611
612 case MAIL_CROSS_PROBE:
613 ExecuteRemoteCommand( payload.c_str() );
614 break;
615
616
617 case MAIL_SELECTION:
618 if( !GetPcbNewSettings()->m_CrossProbing.on_selection )
619 break;
620
622
624 {
625 // $SELECT: <mode 0 - only footprints, 1 - with connections>,<spec1>,<spec2>,<spec3>
626 std::string prefix = "$SELECT: ";
627
628 if( !payload.compare( 0, prefix.size(), prefix ) )
629 {
630 std::string del = ",";
631 std::string paramStr = payload.substr( prefix.size() );
632 size_t modeEnd = paramStr.find( del );
633 bool selectConnections = false;
634
635 try
636 {
637 if( std::stoi( paramStr.substr( 0, modeEnd ) ) == 1 )
638 selectConnections = true;
639 }
640 catch( std::invalid_argument& )
641 {
642 wxFAIL;
643 }
644
645 std::vector<BOARD_ITEM*> items =
646 FindItemsFromSyncSelection( paramStr.substr( modeEnd + 1 ) );
647
648 m_ProbingSchToPcb = true; // recursion guard
649
650 if( selectConnections )
652 else
654
655 // Update 3D viewer highlighting
656 Update3DView( false, GetPcbNewSettings()->m_Display.m_Live3DRefresh );
657
658 m_ProbingSchToPcb = false;
659
660 if( GetPcbNewSettings()->m_CrossProbing.flash_selection )
661 {
662 wxLogTrace( traceCrossProbeFlash, "MAIL_SELECTION(_FORCE) PCB: flash enabled, items=%zu", items.size() );
663 if( items.empty() )
664 {
665 wxLogTrace( traceCrossProbeFlash, "MAIL_SELECTION(_FORCE) PCB: nothing to flash" );
666 }
667 else
668 {
669 std::vector<BOARD_ITEM*> boardItems;
670 std::copy( items.begin(), items.end(), std::back_inserter( boardItems ) );
671 StartCrossProbeFlash( boardItems );
672 }
673 }
674 else
675 {
676 wxLogTrace( traceCrossProbeFlash, "MAIL_SELECTION(_FORCE) PCB: flash disabled" );
677 }
678 }
679
680 break;
681 }
682
683 case MAIL_PCB_UPDATE:
685 break;
686
687 case MAIL_IMPORT_FILE:
688 {
689 // Extract file format type and path (plugin type, path and properties keys, values separated with \n)
690 std::stringstream ss( payload );
691 char delim = '\n';
692
693 std::string formatStr;
694 wxCHECK( std::getline( ss, formatStr, delim ), /* void */ );
695
696 std::string fnameStr;
697 wxCHECK( std::getline( ss, fnameStr, delim ), /* void */ );
698 wxASSERT( !fnameStr.empty() );
699
700 int importFormat;
701
702 try
703 {
704 importFormat = std::stoi( formatStr );
705 }
706 catch( std::invalid_argument& )
707 {
708 wxFAIL;
709 importFormat = -1;
710 }
711
712 std::map<std::string, UTF8> props;
713
714 std::string key, value;
715 do
716 {
717 if( !std::getline( ss, key, delim ) )
718 break;
719
720 if( !std::getline( ss, value, delim ) )
721 break;
722
723 props.emplace( key, value );
724
725 } while( true );
726
727 if( importFormat >= 0 )
728 importFile( fnameStr, importFormat, props.empty() ? nullptr : &props );
729
730 break;
731 }
732
735 break;
736
737 case MAIL_RELOAD_LIB:
738 {
739 m_designBlocksPane->RefreshLibs();
740
741 // Show any footprint library load errors in the status bar
742 if( KISTATUSBAR* statusBar = dynamic_cast<KISTATUSBAR*>( GetStatusBar() ) )
743 {
745 wxString errors = adapter->GetLibraryLoadErrors();
746
747 if( !errors.IsEmpty() )
748 statusBar->SetLoadWarningMessages( errors );
749 }
750
751 break;
752 }
753
754 // many many others.
755 default:
756 ;
757 }
758}
759
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:322
const std::set< int > & GetHighLightNetCodes() const
Definition board.h:620
void SetHighLightNet(int aNetCode, bool aMulti=false)
Select the netcode to be highlighted.
Definition board.cpp:3277
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition board.cpp:2371
const ZONES & Zones() const
Definition board.h:367
void ResetNetHighLight()
Reset all high light data to the init state.
Definition board.cpp:3268
const FOOTPRINTS & Footprints() const
Definition board.h:363
const TRACKS & Tracks() const
Definition board.h:361
bool IsHighLightNetON() const
Definition board.h:636
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
Definition board.cpp:3290
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:99
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:111
virtual const wxString & GetText() const
Return the string associated with the text object.
Definition eda_text.h:98
An interface to the global shared library manager that is schematic-specific and linked to one projec...
const wxString & GetReference() const
Definition footprint.h:751
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.
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:780
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition view.h:221
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:505
wxString GetLibraryLoadErrors() const
Returns all library load errors as newline-separated strings for display.
Handle the data for a net.
Definition netinfo.h:54
int GetNetCode() const
Definition netinfo.h:106
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:73
#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:90
@ FP_BOARD_ONLY
Definition footprint.h:88
@ FP_EXCLUDE_FROM_BOM
Definition footprint.h:87
@ 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:642
#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:111
@ 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