KiCad PCB EDA Suite
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-2022 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 <painter.h>
49#include <pcb_edit_frame.h>
50#include <pcbnew_settings.h>
51#include <render_settings.h>
52#include <tool/tool_manager.h>
53#include <tools/pcb_actions.h>
56#include <wx/log.h>
57
58/* Execute a remote command send by Eeschema via a socket,
59 * port KICAD_PCB_PORT_SERVICE_NUMBER
60 * cmdline = received command from Eeschema
61 * Commands are:
62 * $NET: "net name" Highlight the given net
63 * $NETS: "net name 1,net name 2" Highlight all given nets
64 * $CLEAR Clear existing highlight
65 * They are a keyword followed by a quoted string.
66 */
67void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
68{
69 char line[1024];
70 wxString msg;
71 wxString modName;
72 char* idcmd;
73 char* text;
74 int netcode = -1;
75 bool multiHighlight = false;
76 FOOTPRINT* footprint = nullptr;
77 PAD* pad = nullptr;
78 BOARD* pcb = GetBoard();
79
81
83 KIGFX::RENDER_SETTINGS* renderSettings = view->GetPainter()->GetSettings();
84
85 strncpy( line, cmdline, sizeof(line) - 1 );
86 line[sizeof(line) - 1] = 0;
87
88 idcmd = strtok( line, " \n\r" );
89 text = strtok( nullptr, "\"\n\r" );
90
91 if( idcmd == nullptr )
92 return;
93
94 if( strcmp( idcmd, "$NET:" ) == 0 )
95 {
96 if( !crossProbingSettings.auto_highlight )
97 return;
98
99 wxString net_name = FROM_UTF8( text );
100
101 NETINFO_ITEM* netinfo = pcb->FindNet( net_name );
102
103 if( netinfo )
104 {
105 netcode = netinfo->GetNetCode();
106
107 std::vector<MSG_PANEL_ITEM> items;
108 netinfo->GetMsgPanelInfo( this, items );
109 SetMsgPanel( items );
110 }
111 }
112
113 if( strcmp( idcmd, "$NETS:" ) == 0 )
114 {
115 if( !crossProbingSettings.auto_highlight )
116 return;
117
118 wxStringTokenizer netsTok = wxStringTokenizer( FROM_UTF8( text ), wxT( "," ) );
119 bool first = true;
120
121 while( netsTok.HasMoreTokens() )
122 {
123 NETINFO_ITEM* netinfo = pcb->FindNet( netsTok.GetNextToken() );
124
125 if( netinfo )
126 {
127 if( first )
128 {
129 // TODO: Once buses are included in netlist, show bus name
130 std::vector<MSG_PANEL_ITEM> items;
131 netinfo->GetMsgPanelInfo( this, items );
132 SetMsgPanel( items );
133 first = false;
134
135 pcb->SetHighLightNet( netinfo->GetNetCode() );
136 renderSettings->SetHighlight( true, netinfo->GetNetCode() );
137 multiHighlight = true;
138 }
139 else
140 {
141 pcb->SetHighLightNet( netinfo->GetNetCode(), true );
142 renderSettings->SetHighlight( true, netinfo->GetNetCode(), true );
143 }
144 }
145 }
146
147 netcode = -1;
148 }
149 else if( strcmp( idcmd, "$CLEAR" ) == 0 )
150 {
151 if( renderSettings->IsHighlightEnabled() )
152 {
153 renderSettings->SetHighlight( false );
154 view->UpdateAllLayersColor();
155 }
156
157 if( pcb->IsHighLightNetON() )
158 {
159 pcb->ResetNetHighLight();
160 SetMsgPanel( pcb );
161 }
162
163 GetCanvas()->Refresh();
164 return;
165 }
166
167 BOX2I bbox;
168
169 if( footprint )
170 {
171 bbox = footprint->GetBoundingBox( true, false ); // No invisible text in bbox calc
172
173 if( pad )
175 else
176 m_toolManager->RunAction( PCB_ACTIONS::highlightItem, true, (void*) footprint );
177 }
178 else if( netcode > 0 || multiHighlight )
179 {
180 if( !multiHighlight )
181 {
182 renderSettings->SetHighlight( ( netcode >= 0 ), netcode );
183 pcb->SetHighLightNet( netcode );
184 }
185 else
186 {
187 // Just pick the first one for area calculation
188 netcode = *pcb->GetHighLightNetCodes().begin();
189 }
190
191 pcb->HighLightON();
192
193 auto merge_area =
194 [netcode, &bbox]( BOARD_CONNECTED_ITEM* aItem )
195 {
196 if( aItem->GetNetCode() == netcode )
197 bbox.Merge( aItem->GetBoundingBox() );
198 };
199
200 if( crossProbingSettings.center_on_items )
201 {
202 for( ZONE* zone : pcb->Zones() )
203 merge_area( zone );
204
205 for( PCB_TRACK* track : pcb->Tracks() )
206 merge_area( track );
207
208 for( FOOTPRINT* fp : pcb->Footprints() )
209 {
210 for( PAD* p : fp->Pads() )
211 merge_area( p );
212 }
213 }
214 }
215 else
216 {
217 renderSettings->SetHighlight( false );
218 }
219
220 if( crossProbingSettings.center_on_items && bbox.GetWidth() != 0 && bbox.GetHeight() != 0 )
221 {
222 if( crossProbingSettings.zoom_to_fit )
223 GetToolManager()->GetTool<PCB_SELECTION_TOOL>()->ZoomFitCrossProbeBBox( bbox );
224
225 FocusOnLocation( bbox.Centre() );
226 }
227
228 view->UpdateAllLayersColor();
229
230 // Ensure the display is refreshed, because in some installs the refresh is done only
231 // when the gal canvas has the focus, and that is not the case when crossprobing from
232 // Eeschema:
233 GetCanvas()->Refresh();
234}
235
236
237std::string FormatProbeItem( BOARD_ITEM* aItem )
238{
239 FOOTPRINT* footprint;
240
241 if( !aItem )
242 return "$CLEAR: \"HIGHLIGHTED\""; // message to clear highlight state
243
244 switch( aItem->Type() )
245 {
246 case PCB_FOOTPRINT_T:
247 footprint = (FOOTPRINT*) aItem;
248 return StrPrintf( "$PART: \"%s\"", TO_UTF8( footprint->GetReference() ) );
249
250 case PCB_PAD_T:
251 {
252 footprint = static_cast<FOOTPRINT*>( aItem->GetParent() );
253 wxString pad = static_cast<PAD*>( aItem )->GetNumber();
254
255 return StrPrintf( "$PART: \"%s\" $PAD: \"%s\"",
256 TO_UTF8( footprint->GetReference() ),
257 TO_UTF8( pad ) );
258 }
259
260 case PCB_FP_TEXT_T:
261 {
262 footprint = static_cast<FOOTPRINT*>( aItem->GetParent() );
263
264 FP_TEXT* text = static_cast<FP_TEXT*>( aItem );
265 const char* text_key;
266
267 /* This can't be a switch since the break need to pull out
268 * from the outer switch! */
269 if( text->GetType() == FP_TEXT::TEXT_is_REFERENCE )
270 text_key = "$REF:";
271 else if( text->GetType() == FP_TEXT::TEXT_is_VALUE )
272 text_key = "$VAL:";
273 else
274 break;
275
276 return StrPrintf( "$PART: \"%s\" %s \"%s\"",
277 TO_UTF8( footprint->GetReference() ),
278 text_key,
279 TO_UTF8( text->GetText() ) );
280 }
281
282 default:
283 break;
284 }
285
286 return "";
287}
288
289
290template <typename ItemContainer>
291void collectItemsForSyncParts( ItemContainer& aItems, std::set<wxString>& parts )
292{
293 for( EDA_ITEM* item : aItems )
294 {
295 switch( item->Type() )
296 {
297 case PCB_GROUP_T:
298 {
299 PCB_GROUP* group = static_cast<PCB_GROUP*>( item );
300
301 collectItemsForSyncParts( group->GetItems(), parts );
302
303 break;
304 }
305 case PCB_FOOTPRINT_T:
306 {
307 FOOTPRINT* footprint = static_cast<FOOTPRINT*>( item );
308 wxString ref = footprint->GetReference();
309
310 parts.emplace( wxT( "F" ) + EscapeString( ref, CTX_IPC ) );
311
312 break;
313 }
314
315 case PCB_PAD_T:
316 {
317 PAD* pad = static_cast<PAD*>( item );
318 FOOTPRINT* footprint = static_cast<FOOTPRINT*>( pad->GetParentFootprint() );
319 wxString ref = footprint->GetReference();
320
321 parts.emplace( wxT( "P" ) + EscapeString( ref, CTX_IPC ) + wxT( "/" )
322 + EscapeString( pad->GetNumber(), CTX_IPC ) );
323
324 break;
325 }
326
327 default: break;
328 }
329 }
330}
331
332
333void PCB_EDIT_FRAME::SendSelectItemsToSch( const std::deque<EDA_ITEM*>& aItems,
334 EDA_ITEM* aFocusItem, bool aForce )
335{
336 std::string command = "$SELECT: ";
337
338 if( aFocusItem )
339 {
340 std::deque<EDA_ITEM*> focusItems = { aFocusItem };
341 std::set<wxString> focusParts;
342 collectItemsForSyncParts( focusItems, focusParts );
343
344 if( focusParts.size() > 0 )
345 {
346 command += "1,";
347 command += *focusParts.begin();
348 command += ",";
349 }
350 else
351 {
352 command += "0,";
353 }
354 }
355 else
356 {
357 command += "0,";
358 }
359
360 std::set<wxString> parts;
361 collectItemsForSyncParts( aItems, parts );
362
363 if( parts.empty() )
364 return;
365
366 for( wxString part : parts )
367 {
368 command += part;
369 command += ",";
370 }
371
372 command.pop_back();
373
374 if( Kiface().IsSingle() )
375 {
376 SendCommand( MSG_TO_PCB, command );
377 }
378 else
379 {
380 // Typically ExpressMail is going to be s-expression packets, but since
381 // we have existing interpreter of the selection packet on the other
382 // side in place, we use that here.
384 this );
385 }
386}
387
388
389void PCB_EDIT_FRAME::SendCrossProbeNetName( const wxString& aNetName )
390{
391 std::string packet = StrPrintf( "$NET: \"%s\"", TO_UTF8( aNetName ) );
392
393 if( !packet.empty() )
394 {
395 if( Kiface().IsSingle() )
396 {
397 SendCommand( MSG_TO_SCH, packet );
398 }
399 else
400 {
401 // Typically ExpressMail is going to be s-expression packets, but since
402 // we have existing interpreter of the cross probe packet on the other
403 // side in place, we use that here.
404 Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this );
405 }
406 }
407}
408
409
411{
412 std::string packet = FormatProbeItem( aSyncItem );
413
414 if( !packet.empty() )
415 {
416 if( Kiface().IsSingle() )
417 {
418 SendCommand( MSG_TO_SCH, packet );
419 }
420 else
421 {
422 // Typically ExpressMail is going to be s-expression packets, but since
423 // we have existing interpreter of the cross probe packet on the other
424 // side in place, we use that here.
425 Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this );
426 }
427 }
428}
429
430
431std::vector<BOARD_ITEM*> PCB_EDIT_FRAME::FindItemsFromSyncSelection( std::string syncStr )
432{
433 wxArrayString syncArray = wxStringTokenize( syncStr, "," );
434
435 std::vector<std::pair<int, BOARD_ITEM*>> orderPairs;
436
437 for( FOOTPRINT* footprint : GetBoard()->Footprints() )
438 {
439 if( footprint == nullptr )
440 continue;
441
442 wxString fpSheetPath = footprint->GetPath().AsString().BeforeLast( '/' );
443 wxString fpUUID = footprint->m_Uuid.AsString();
444
445 if( fpSheetPath.IsEmpty() )
446 fpSheetPath += '/';
447
448 if( fpUUID.empty() )
449 continue;
450
451 wxString fpRefEscaped = EscapeString( footprint->GetReference(), CTX_IPC );
452
453 for( unsigned index = 0; index < syncArray.size(); ++index )
454 {
455 wxString syncEntry = syncArray[index];
456
457 if( syncEntry.empty() )
458 continue;
459
460 wxString syncData = syncEntry.substr( 1 );
461
462 switch( syncEntry.GetChar( 0 ).GetValue() )
463 {
464 case 'S': // Select sheet with subsheets: S<Sheet path>
465 if( fpSheetPath.StartsWith( syncData ) )
466 {
467 orderPairs.emplace_back( index, footprint );
468 }
469 break;
470 case 'F': // Select footprint: F<Reference>
471 if( syncData == fpRefEscaped )
472 {
473 orderPairs.emplace_back( index, footprint );
474 }
475 break;
476 case 'P': // Select pad: P<Footprint reference>/<Pad number>
477 {
478 if( syncData.StartsWith( fpRefEscaped ) )
479 {
480 wxString selectPadNumberEscaped =
481 syncData.substr( fpRefEscaped.size() + 1 ); // Skips the slash
482
483 wxString selectPadNumber = UnescapeString( selectPadNumberEscaped );
484
485 for( PAD* pad : footprint->Pads() )
486 {
487 if( selectPadNumber == pad->GetNumber() )
488 {
489 orderPairs.emplace_back( index, pad );
490 }
491 }
492 }
493 break;
494 }
495 default: break;
496 }
497 }
498 }
499
500 std::sort(
501 orderPairs.begin(), orderPairs.end(),
502 []( const std::pair<int, BOARD_ITEM*>& a, const std::pair<int, BOARD_ITEM*>& b ) -> bool
503 {
504 return a.first < b.first;
505 } );
506
507 std::vector<BOARD_ITEM*> items;
508 items.reserve( orderPairs.size() );
509
510 for( const std::pair<int, BOARD_ITEM*>& pair : orderPairs )
511 items.push_back( pair.second );
512
513 return items;
514}
515
516
518{
519 std::string& payload = mail.GetPayload();
520
521 switch( mail.Command() )
522 {
524 {
527
528 for( FOOTPRINT* footprint : GetBoard()->Footprints() )
529 {
530 if( footprint->GetAttributes() & FP_BOARD_ONLY )
531 continue; // Don't add board-only footprints to the netlist
532
533 COMPONENT* component = new COMPONENT( footprint->GetFPID(), footprint->GetReference(),
534 footprint->GetValue(), footprint->GetPath(), {} );
535
536 for( PAD* pad : footprint->Pads() )
537 {
538 const wxString& netname = pad->GetShortNetname();
539
540 if( !netname.IsEmpty() )
541 {
542 component->AddNet( pad->GetNumber(), netname, pad->GetPinFunction(),
543 pad->GetPinType() );
544 }
545 }
546
547 netlist.AddComponent( component );
548 }
549
550 netlist.Format( "pcb_netlist", &sf, 0, CTL_OMIT_FILTERS );
551 payload = sf.GetString();
552 break;
553 }
554
556 try
557 {
559 FetchNetlistFromSchematic( netlist, wxEmptyString );
560
561 BOARD_NETLIST_UPDATER updater( this, GetBoard() );
562 updater.SetLookupByTimestamp( false );
563 updater.SetDeleteUnusedFootprints( false );
564 updater.SetReplaceFootprints( false );
565 updater.UpdateNetlist( netlist );
566
567 bool dummy;
568 OnNetlistChanged( updater, &dummy );
569 }
570 catch( const IO_ERROR& )
571 {
572 assert( false ); // should never happen
573 return;
574 }
575
576 break;
577
578 case MAIL_CROSS_PROBE:
579 ExecuteRemoteCommand( payload.c_str() );
580 break;
581
582
583 case MAIL_SELECTION:
584 if( !GetPcbNewSettings()->m_CrossProbing.on_selection )
585 break;
586
588
590 {
591 // $SELECT: <mode 0 - only footprints, 1 - with connections>,<spec1>,<spec2>,<spec3>
592 std::string prefix = "$SELECT: ";
593
594 if( !payload.compare( 0, prefix.size(), prefix ) )
595 {
596 std::string del = ",";
597 std::string paramStr = payload.substr( prefix.size() );
598 int modeEnd = paramStr.find( del );
599 bool selectConnections = false;
600
601 try
602 {
603 if( std::stoi( paramStr.substr( 0, modeEnd ) ) == 1 )
604 selectConnections = true;
605 }
606 catch( std::invalid_argument& )
607 {
608 wxFAIL;
609 }
610
611 std::vector<BOARD_ITEM*> items =
612 FindItemsFromSyncSelection( paramStr.substr( modeEnd + 1 ) );
613
614 m_probingSchToPcb = true; // recursion guard
615
616 if( selectConnections )
617 {
619 static_cast<void*>( &items ) );
620 }
621 else
622 {
624 static_cast<void*>( &items ) );
625 }
626
627 // Update 3D viewer highlighting
628 Update3DView( false, GetPcbNewSettings()->m_Display.m_Live3DRefresh );
629
630 m_probingSchToPcb = false;
631 }
632
633 break;
634 }
635
636 case MAIL_PCB_UPDATE:
638 break;
639
640 case MAIL_IMPORT_FILE:
641 {
642 // Extract file format type and path (plugin type and path separated with \n)
643 size_t split = payload.find( '\n' );
644 wxCHECK( split != std::string::npos, /*void*/ );
645 int importFormat;
646
647 try
648 {
649 importFormat = std::stoi( payload.substr( 0, split ) );
650 }
651 catch( std::invalid_argument& )
652 {
653 wxFAIL;
654 importFormat = -1;
655 }
656
657 std::string path = payload.substr( split + 1 );
658 wxASSERT( !path.empty() );
659
660 if( importFormat >= 0 )
661 importFile( path, importFormat );
662
663 break;
664 }
665
668 break;
669
670 // many many others.
671 default:
672 ;
673 }
674}
675
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
static TOOL_ACTION updatePcbFromSchematic
Definition: actions.h:168
CROSS_PROBING_SETTINGS m_CrossProbing
Definition: app_settings.h:173
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:70
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:175
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:269
const std::set< int > & GetHighLightNetCodes() const
Definition: board.h:478
ZONES & Zones()
Definition: board.h:317
void SetHighLightNet(int aNetCode, bool aMulti=false)
Select the netcode to be highlighted.
Definition: board.cpp:2092
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:1478
void ResetNetHighLight()
Reset all high light data to the init state.
Definition: board.cpp:2083
FOOTPRINTS & Footprints()
Definition: board.h:311
TRACKS & Tracks()
Definition: board.h:308
bool IsHighLightNetON() const
Definition: board.h:494
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
Definition: board.cpp:2105
coord_type GetHeight() const
Definition: box2.h:188
coord_type GetWidth() const
Definition: box2.h:187
Vec Centre() const
Definition: box2.h:70
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: box2.h:588
Store all of the related footprint information found in a netlist.
Definition: pcb_netlist.h:85
void AddNet(const wxString &aPinName, const wxString &aNetName, const wxString &aPinFunction, const wxString &aPinType)
Definition: pcb_netlist.h:103
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
Update the board display after modifying it by a python script (note: it is automatically called by a...
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:85
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
const wxString & GetReference() const
Definition: footprint.h:519
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: footprint.cpp:806
@ TEXT_is_REFERENCE
Definition: fp_text.h:49
@ TEXT_is_VALUE
Definition: fp_text.h:50
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:76
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:69
void UpdateAllLayersColor()
Apply the new coloring scheme to all layers.
Definition: view.cpp:761
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:213
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition: kiway_express.h:39
std::string & GetPayload()
Return the payload, which can be any text but it typically self identifying s-expression.
Definition: kiway_express.h:57
MAIL_T Command()
Returns the MAIL_T associated with this mail.
Definition: kiway_express.h:49
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr)
Send aPayload to aDestination from aSource.
Definition: kiway.cpp:491
Handle the data for a net.
Definition: netinfo.h:67
int GetNetCode() const
Definition: netinfo.h:119
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:213
Definition: pad.h:60
static TOOL_ACTION highlightItem
Definition: pcb_actions.h:501
static TOOL_ACTION pluginsReload
Scripting Actions.
Definition: pcb_actions.h:354
static TOOL_ACTION syncSelection
Sets selection to specified items, zooms to fit, if enabled.
Definition: pcb_actions.h:70
static TOOL_ACTION syncSelectionWithNets
Sets selection to specified items with connected nets, zooms to fit, if enabled.
Definition: pcb_actions.h:73
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 KiwayMailIn(KIWAY_EXPRESS &aEvent) override
Receive KIWAY_EXPRESS messages from other players.
bool importFile(const wxString &aFileName, int aFileType)
Load the given filename but sets the path to the current project path.
void OnNetlistChanged(BOARD_NETLIST_UPDATER &aUpdater, bool *aRunDragCommand)
Called after netlist is updated.
Definition: netlist.cpp:84
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.
void SendCrossProbeNetName(const wxString &aNetName)
Send a net name to Eeschema for highlighting.
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:51
The selection tool: currently supports:
Implement an OUTPUTFORMATTER to a memory buffer.
Definition: richio.h:415
const std::string & GetString()
Definition: richio.h:438
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:170
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:54
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:142
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:285
Handle a list of polygons defining a copper zone.
Definition: zone.h:57
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_PCB
Definition: eda_dde.h:49
#define MSG_TO_SCH
Definition: eda_dde.h:50
@ FP_BOARD_ONLY
Definition: footprint.h:72
@ 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
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:96
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:110
@ MAIL_PCB_UPDATE_LINKS
Definition: mail_type.h:51
@ 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:56
@ MAIL_SELECTION
Definition: mail_type.h:40
@ MAIL_PCB_GET_NETLIST
Definition: mail_type.h:50
#define CTL_OMIT_FILTERS
Definition: pcb_netlist.h:288
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:84
std::vector< FAB_LAYER_COLOR > dummy
wxString UnescapeString(const wxString &aSource)
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
@ CTX_IPC
Definition: string_utils.h:56
static std::vector< std::string > split(const std::string &aStr, const std::string &aDelim)
Split the input string into a vector of output strings.
Definition: string_utils.h:296
Cross-probing behavior.
Definition: app_settings.h:31
bool zoom_to_fit
Zoom to fit items (ignored if center_on_items is off)
Definition: app_settings.h:34
bool center_on_items
Automatically pan to cross-probed items.
Definition: app_settings.h:33
bool auto_highlight
Automatically turn on highlight mode in the target frame.
Definition: app_settings.h:35
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:115
@ 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
@ PCB_FP_TEXT_T
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92