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