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-2021 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>
35 #include <board_design_settings.h>
36 #include <footprint.h>
37 #include <pad.h>
38 #include <pcb_track.h>
39 #include <zone.h>
40 #include <collectors.h>
41 #include <eda_dde.h>
42 #include <kiface_base.h>
43 #include <kiway_express.h>
46 #include <painter.h>
47 #include <pcb_edit_frame.h>
48 #include <pcbnew_settings.h>
49 #include <render_settings.h>
50 #include <tool/tool_manager.h>
51 #include <tools/pcb_actions.h>
54 #include <wx/log.h>
55 
56 /* Execute a remote command send by Eeschema via a socket,
57  * port KICAD_PCB_PORT_SERVICE_NUMBER
58  * cmdline = received command from Eeschema
59  * Commands are
60  * $PART: "reference" put cursor on component
61  * $PIN: "pin name" $PART: "reference" put cursor on the footprint pin
62  * $NET: "net name" highlight the given net (if highlight tool is active)
63  * $CLEAR Clear existing highlight
64  * They are a keyword followed by a quoted string.
65  */
66 void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
67 {
68  char line[1024];
69  wxString msg;
70  wxString modName;
71  char* idcmd;
72  char* text;
73  int netcode = -1;
74  bool multiHighlight = false;
75  FOOTPRINT* footprint = nullptr;
76  PAD* pad = nullptr;
77  BOARD* pcb = GetBoard();
78 
79  CROSS_PROBING_SETTINGS& crossProbingSettings = GetPcbNewSettings()->m_CrossProbing;
80 
82  KIGFX::RENDER_SETTINGS* renderSettings = view->GetPainter()->GetSettings();
83 
84  strncpy( line, cmdline, sizeof(line) - 1 );
85  line[sizeof(line) - 1] = 0;
86 
87  idcmd = strtok( line, " \n\r" );
88  text = strtok( nullptr, "\"\n\r" );
89 
90  if( idcmd == nullptr )
91  return;
92 
93  if( strcmp( idcmd, "$NET:" ) == 0 )
94  {
95  if( !crossProbingSettings.auto_highlight )
96  return;
97 
98  wxString net_name = FROM_UTF8( text );
99 
100  NETINFO_ITEM* netinfo = pcb->FindNet( net_name );
101 
102  if( netinfo )
103  {
104  netcode = netinfo->GetNetCode();
105 
106  MSG_PANEL_ITEMS items;
107  netinfo->GetMsgPanelInfo( this, items );
108  SetMsgPanel( items );
109  }
110  }
111 
112  if( strcmp( idcmd, "$NETS:" ) == 0 )
113  {
114  if( !crossProbingSettings.auto_highlight )
115  return;
116 
117  wxStringTokenizer netsTok = wxStringTokenizer( FROM_UTF8( text ), "," );
118  bool first = true;
119 
120  while( netsTok.HasMoreTokens() )
121  {
122  NETINFO_ITEM* netinfo = pcb->FindNet( netsTok.GetNextToken() );
123 
124  if( netinfo )
125  {
126  if( first )
127  {
128  // TODO: Once buses are included in netlist, show bus name
129  MSG_PANEL_ITEMS items;
130  netinfo->GetMsgPanelInfo( this, items );
131  SetMsgPanel( items );
132  first = false;
133 
134  pcb->SetHighLightNet( netinfo->GetNetCode() );
135  renderSettings->SetHighlight( true, netinfo->GetNetCode() );
136  multiHighlight = true;
137  }
138  else
139  {
140  pcb->SetHighLightNet( netinfo->GetNetCode(), true );
141  renderSettings->SetHighlight( true, netinfo->GetNetCode(), true );
142  }
143  }
144  }
145 
146  netcode = -1;
147  }
148  else if( strcmp( idcmd, "$PIN:" ) == 0 )
149  {
150  wxString pinName = FROM_UTF8( text );
151 
152  text = strtok( nullptr, " \n\r" );
153 
154  if( text && strcmp( text, "$PART:" ) == 0 )
155  text = strtok( nullptr, "\"\n\r" );
156 
157  modName = FROM_UTF8( text );
158 
159  footprint = pcb->FindFootprintByReference( modName );
160 
161  if( footprint )
162  pad = footprint->FindPadByNumber( pinName );
163 
164  if( pad )
165  netcode = pad->GetNetCode();
166 
167  if( footprint == nullptr )
168  msg.Printf( _( "%s not found" ), modName );
169  else if( pad == nullptr )
170  msg.Printf( _( "%s pin %s not found" ), modName, pinName );
171  else
172  msg.Printf( _( "%s pin %s found" ), modName, pinName );
173 
174  SetStatusText( msg );
175  }
176  else if( strcmp( idcmd, "$PART:" ) == 0 )
177  {
178  pcb->ResetNetHighLight();
179 
180  modName = FROM_UTF8( text );
181 
182  footprint = pcb->FindFootprintByReference( modName );
183 
184  if( footprint )
185  msg.Printf( _( "%s found" ), modName );
186  else
187  msg.Printf( _( "%s not found" ), modName );
188 
189  SetStatusText( msg );
190  }
191  else if( strcmp( idcmd, "$SHEET:" ) == 0 )
192  {
193  msg.Printf( _( "Selecting all from sheet \"%s\"" ), FROM_UTF8( text ) );
194  wxString sheetUIID( FROM_UTF8( text ) );
195  SetStatusText( msg );
197  static_cast<void*>( &sheetUIID ) );
198  return;
199  }
200  else if( strcmp( idcmd, "$CLEAR" ) == 0 )
201  {
202  if( renderSettings->IsHighlightEnabled() )
203  {
204  renderSettings->SetHighlight( false );
205  view->UpdateAllLayersColor();
206  }
207 
208  if( pcb->IsHighLightNetON() )
209  {
210  pcb->ResetNetHighLight();
211  SetMsgPanel( pcb );
212  }
213 
214  GetCanvas()->Refresh();
215  return;
216  }
217 
218  BOX2I bbox = { { 0, 0 }, { 0, 0 } };
219 
220  if( footprint )
221  {
222  bbox = footprint->GetBoundingBox( true, false ); // No invisible text in bbox calc
223 
224  if( pad )
226  else
227  m_toolManager->RunAction( PCB_ACTIONS::highlightItem, true, (void*) footprint );
228  }
229  else if( netcode > 0 || multiHighlight )
230  {
231  if( !multiHighlight )
232  {
233  renderSettings->SetHighlight( ( netcode >= 0 ), netcode );
234  pcb->SetHighLightNet( netcode );
235  }
236  else
237  {
238  // Just pick the first one for area calculation
239  netcode = *pcb->GetHighLightNetCodes().begin();
240  }
241 
242  pcb->HighLightON();
243 
244  auto merge_area =
245  [netcode, &bbox]( BOARD_CONNECTED_ITEM* aItem )
246  {
247  if( aItem->GetNetCode() == netcode )
248  {
249  if( bbox.GetWidth() == 0 )
250  bbox = aItem->GetBoundingBox();
251  else
252  bbox.Merge( aItem->GetBoundingBox() );
253  }
254  };
255 
256  if( crossProbingSettings.center_on_items )
257  {
258  for( ZONE* zone : pcb->Zones() )
259  merge_area( zone );
260 
261  for( PCB_TRACK* track : pcb->Tracks() )
262  merge_area( track );
263 
264  for( FOOTPRINT* fp : pcb->Footprints() )
265  {
266  for( PAD* p : fp->Pads() )
267  merge_area( p );
268  }
269  }
270  }
271  else
272  {
273  renderSettings->SetHighlight( false );
274  }
275 
276  if( crossProbingSettings.center_on_items && bbox.GetWidth() > 0 && bbox.GetHeight() > 0 )
277  {
278  if( crossProbingSettings.zoom_to_fit )
279  {
280 //#define DEFAULT_PCBNEW_CODE // Un-comment for normal full zoom KiCad algorithm
281  #ifdef DEFAULT_PCBNEW_CODE
282  auto bbSize = bbox.Inflate( bbox.GetWidth() * 0.2f ).GetSize();
283  auto screenSize = view->ToWorld( GetCanvas()->GetClientSize(), false );
284 
285  // The "fabs" on x ensures the right answer when the view is flipped
286  screenSize.x = std::max( 10.0, fabs( screenSize.x ) );
287  screenSize.y = std::max( 10.0, screenSize.y );
288  double ratio = std::max( fabs( bbSize.x / screenSize.x ),
289  fabs( bbSize.y / screenSize.y ) );
290 
291  // Try not to zoom on every cross-probe; it gets very noisy
292  if( crossProbingSettings.zoom_to_fit && ( ratio < 0.5 || ratio > 1.0 ) )
293  view->SetScale( view->GetScale() / ratio );
294  #endif // DEFAULT_PCBNEW_CODE
295 
296 #ifndef DEFAULT_PCBNEW_CODE // Do the scaled zoom
297  auto bbSize = bbox.Inflate( bbox.GetWidth() * 0.2f ).GetSize();
298  auto screenSize = view->ToWorld( GetCanvas()->GetClientSize(), false );
299 
300  // This code tries to come up with a zoom factor that doesn't simply zoom in
301  // to the cross probed component, but instead shows a reasonable amount of the
302  // circuit around it to provide context. This reduces or eliminates the need
303  // to manually change the zoom because it's too close.
304 
305  // Using the default text height as a constant to compare against, use the
306  // height of the bounding box of visible items for a footprint to figure out
307  // if this is a big footprint (like a processor) or a small footprint (like a resistor).
308  // This ratio is not useful by itself as a scaling factor. It must be "bent" to
309  // provide good scaling at varying component sizes. Bigger components need less
310  // scaling than small ones.
311  double currTextHeight = Millimeter2iu( DEFAULT_TEXT_SIZE );
312 
313  double compRatio = bbSize.y / currTextHeight; // Ratio of component to text height
314 
315  // This will end up as the scaling factor we apply to "ratio".
316  double compRatioBent = 1.0;
317 
318  // This is similar to the original KiCad code that scaled the zoom to make sure
319  // components were visible on screen. It's simply a ratio of screen size to
320  // component size, and its job is to zoom in to make the component fullscreen.
321  // Earlier in the code the component BBox is given a 20% margin to add some
322  // breathing room. We compare the height of this enlarged component bbox to the
323  // default text height. If a component will end up with the sides clipped, we
324  // adjust later to make sure it fits on screen.
325  //
326  // The "fabs" on x ensures the right answer when the view is flipped
327  screenSize.x = std::max( 10.0, fabs( screenSize.x ) );
328  screenSize.y = std::max( 10.0, screenSize.y );
329  double ratio = std::max( -1.0, fabs( bbSize.y / screenSize.y ) );
330 
331  // Original KiCad code for how much to scale the zoom
332  double kicadRatio = std::max( fabs( bbSize.x / screenSize.x ),
333  fabs( bbSize.y / screenSize.y ) );
334 
335  // LUT to scale zoom ratio to provide reasonable schematic context. Must work
336  // with footprints of varying sizes (e.g. 0402 package and 200 pin BGA).
337  // "first" is used as the input and "second" as the output
338  //
339  // "first" = compRatio (footprint height / default text height)
340  // "second" = Amount to scale ratio by
341  std::vector<std::pair<double, double>> lut{
342  { 1, 8 },
343  { 1.5, 5 },
344  { 3, 3 },
345  { 4.5, 2.5 },
346  { 8, 2.0 },
347  { 12, 1.7 },
348  { 16, 1.5 },
349  { 24, 1.3 },
350  { 32, 1.0 },
351  };
352 
353 
354  std::vector<std::pair<double, double>>::iterator it;
355 
356  compRatioBent = lut.back().second; // Large component default
357 
358  if( compRatio >= lut.front().first )
359  {
360  // Use LUT to do linear interpolation of "compRatio" within "first", then
361  // use that result to linearly interpolate "second" which gives the scaling
362  // factor needed.
363 
364  for( it = lut.begin(); it < lut.end() - 1; it++ )
365  {
366  if( it->first <= compRatio && next( it )->first >= compRatio )
367  {
368  double diffx = compRatio - it->first;
369  double diffn = next( it )->first - it->first;
370 
371  compRatioBent =
372  it->second + ( next( it )->second - it->second ) * diffx / diffn;
373  break; // We have our interpolated value
374  }
375  }
376  }
377  else
378  {
379  compRatioBent = lut.front().second; // Small component default
380  }
381 
382  // If the width of the part we're probing is bigger than what the screen width will be
383  // after the zoom, then punt and use the KiCad zoom algorithm since it guarantees the
384  // part's width will be encompassed within the screen. This will apply to parts that
385  // are much wider than they are tall.
386 
387  if( bbSize.x > screenSize.x * ratio * compRatioBent )
388  {
389  // Use standard KiCad zoom algorithm for parts too wide to fit screen/
390  ratio = kicadRatio;
391  compRatioBent = 1.0; // Reset so we don't modify the "KiCad" ratio
392  wxLogTrace( "CROSS_PROBE_SCALE",
393  "Part TOO WIDE for screen. Using normal KiCad zoom ratio: %1.5f",
394  ratio );
395  }
396 
397  // Now that "compRatioBent" holds our final scaling factor we apply it to the original
398  // fullscreen zoom ratio to arrive at the final ratio itself.
399  ratio *= compRatioBent;
400 
401  bool alwaysZoom = false; // DEBUG - allows us to minimize zooming or not
402 
403  // Try not to zoom on every cross-probe; it gets very noisy
404  if( ( ratio < 0.5 || ratio > 1.0 ) || alwaysZoom )
405  view->SetScale( view->GetScale() / ratio );
406 #endif // ifndef DEFAULT_PCBNEW_CODE
407  }
408 
409  view->SetCenter( bbox.Centre() );
410  }
411 
412  view->UpdateAllLayersColor();
413 
414  // Ensure the display is refreshed, because in some installs the refresh is done only
415  // when the gal canvas has the focus, and that is not the case when crossprobing from
416  // Eeschema:
417  GetCanvas()->Refresh();
418 }
419 
420 
421 std::string FormatProbeItem( BOARD_ITEM* aItem )
422 {
423  FOOTPRINT* footprint;
424 
425  if( !aItem )
426  return "$CLEAR: \"HIGHLIGHTED\""; // message to clear highlight state
427 
428  switch( aItem->Type() )
429  {
430  case PCB_FOOTPRINT_T:
431  footprint = (FOOTPRINT*) aItem;
432  return StrPrintf( "$PART: \"%s\"", TO_UTF8( footprint->GetReference() ) );
433 
434  case PCB_PAD_T:
435  {
436  footprint = static_cast<FOOTPRINT*>( aItem->GetParent() );
437  wxString pad = static_cast<PAD*>( aItem )->GetNumber();
438 
439  return StrPrintf( "$PART: \"%s\" $PAD: \"%s\"", TO_UTF8( footprint->GetReference() ),
440  TO_UTF8( pad ) );
441  }
442 
443  case PCB_FP_TEXT_T:
444  {
445  footprint = static_cast<FOOTPRINT*>( aItem->GetParent() );
446 
447  FP_TEXT* text = static_cast<FP_TEXT*>( aItem );
448  const char* text_key;
449 
450  /* This can't be a switch since the break need to pull out
451  * from the outer switch! */
452  if( text->GetType() == FP_TEXT::TEXT_is_REFERENCE )
453  text_key = "$REF:";
454  else if( text->GetType() == FP_TEXT::TEXT_is_VALUE )
455  text_key = "$VAL:";
456  else
457  break;
458 
459  return StrPrintf( "$PART: \"%s\" %s \"%s\"", TO_UTF8( footprint->GetReference() ), text_key,
460  TO_UTF8( text->GetText() ) );
461  }
462 
463  default:
464  break;
465  }
466 
467  return "";
468 }
469 
470 
472 {
473  std::string packet = FormatProbeItem( aSyncItem );
474 
475  if( !packet.empty() )
476  {
477  if( Kiface().IsSingle() )
478  {
479  SendCommand( MSG_TO_SCH, packet );
480  }
481  else
482  {
483  // Typically ExpressMail is going to be s-expression packets, but since
484  // we have existing interpreter of the cross probe packet on the other
485  // side in place, we use that here.
486  Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this );
487  }
488  }
489 }
490 
491 
492 void PCB_EDIT_FRAME::SendCrossProbeNetName( const wxString& aNetName )
493 {
494  std::string packet = StrPrintf( "$NET: \"%s\"", TO_UTF8( aNetName ) );
495 
496  if( !packet.empty() )
497  {
498  if( Kiface().IsSingle() )
499  {
500  SendCommand( MSG_TO_SCH, packet );
501  }
502  else
503  {
504  // Typically ExpressMail is going to be s-expression packets, but since
505  // we have existing interpreter of the cross probe packet on the other
506  // side in place, we use that here.
507  Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this );
508  }
509  }
510 }
511 
512 
514 {
515  std::string& payload = mail.GetPayload();
516 
517  switch( mail.Command() )
518  {
520  {
522  STRING_FORMATTER sf;
523 
524  for( FOOTPRINT* footprint : GetBoard()->Footprints() )
525  {
526  if( footprint->GetAttributes() & FP_BOARD_ONLY )
527  continue; // Don't add board-only footprints to the netlist
528 
529  COMPONENT* component = new COMPONENT( footprint->GetFPID(), footprint->GetReference(),
530  footprint->GetValue(), footprint->GetPath(), {} );
531 
532  for( PAD* pad : footprint->Pads() )
533  {
534  const wxString& netname = pad->GetShortNetname();
535 
536  if( !netname.IsEmpty() )
537  {
538  component->AddNet( pad->GetNumber(), netname, pad->GetPinFunction(),
539  pad->GetPinType() );
540  }
541  }
542 
543  netlist.AddComponent( component );
544  }
545 
546  netlist.Format( "pcb_netlist", &sf, 0, CTL_OMIT_FILTERS );
547  payload = sf.GetString();
548  break;
549  }
550 
552  try
553  {
555  FetchNetlistFromSchematic( netlist, wxEmptyString );
556 
557  BOARD_NETLIST_UPDATER updater( this, GetBoard() );
558  updater.SetLookupByTimestamp( false );
559  updater.SetDeleteUnusedFootprints( false );
560  updater.SetReplaceFootprints( false );
561  updater.UpdateNetlist( netlist );
562 
563  bool dummy;
564  OnNetlistChanged( updater, &dummy );
565  }
566  catch( const IO_ERROR& )
567  {
568  assert( false ); // should never happen
569  return;
570  }
571 
572  break;
573 
574  case MAIL_CROSS_PROBE:
575  ExecuteRemoteCommand( payload.c_str() );
576  break;
577 
578  case MAIL_PCB_UPDATE:
580  break;
581 
582  case MAIL_IMPORT_FILE:
583  {
584  // Extract file format type and path (plugin type and path separated with \n)
585  size_t split = payload.find( '\n' );
586  wxCHECK( split != std::string::npos, /*void*/ );
587  int importFormat;
588 
589  try
590  {
591  importFormat = std::stoi( payload.substr( 0, split ) );
592  }
593  catch( std::invalid_argument& )
594  {
595  wxFAIL;
596  importFormat = -1;
597  }
598 
599  std::string path = payload.substr( split + 1 );
600  wxASSERT( !path.empty() );
601 
602  if( importFormat >= 0 )
603  importFile( path, importFormat );
604 
605  break;
606  }
607 
608  // many many others.
609  default:
610  ;
611  }
612 }
613 
CITER next(CITER it)
Definition: ptree.cpp:126
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:1344
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:283
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition: kiway_express.h:38
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
DDE server & client.
void SendCrossProbeNetName(const wxString &aNetName)
Send a net name to Eeschema for highlighting.
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92
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
ZONES & Zones()
Definition: board.h:239
bool importFile(const wxString &aFileName, int aFileType)
Load the given filename but sets the path to the current project path.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
Definition: board.cpp:2043
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:80
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:452
Update the BOARD with a new netlist.
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
static TOOL_ACTION highlightItem
Definition: pcb_actions.h:453
bool IsHighLightNetON() const
Definition: board.h:402
#define MSG_TO_SCH
Definition: eda_dde.h:50
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
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:304
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr)
Send aPayload to aDestination from aSource.
Definition: kiway.cpp:476
class PAD, a pad in a footprint
Definition: typeinfo.h:89
static TOOL_ACTION updatePcbFromSchematic
Definition: actions.h:163
bool FetchNetlistFromSchematic(NETLIST &aNetlist, const wxString &aAnnotateMessage)
void SetLookupByTimestamp(bool aEnabled)
bool IsHighlightEnabled() const
Return current highlight setting.
void OnNetlistChanged(BOARD_NETLIST_UPDATER &aUpdater, bool *aRunDragCommand)
Called after netlist is updated.
Definition: netlist.cpp:89
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
bool UpdateNetlist(NETLIST &aNetlist)
Update the board's components according to the new netlist.
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:208
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:78
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:72
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:96
void KiwayMailIn(KIWAY_EXPRESS &aEvent) override
Receive KIWAY_EXPRESS messages from other players.
Cross-probing behavior.
Definition: app_settings.h:30
void ResetNetHighLight()
Reset all high light data to the init state.
Definition: board.cpp:2021
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
Definition: view.cpp:581
Store information read from a netlist along with the flags used to update the NETLIST in the BOARD.
Definition: pcb_netlist.h:206
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
void ExecuteRemoteCommand(const char *cmdline) override
Execute a remote command send by Eeschema via a socket, port KICAD_PCB_PORT_SERVICE_NUMBER (currently...
coord_type GetWidth() const
Definition: box2.h:180
#define CTL_OMIT_FILTERS
Definition: pcb_netlist.h:282
FOOTPRINTS & Footprints()
Definition: board.h:233
void SetReplaceFootprints(bool aEnabled)
PAD * FindPadByNumber(const wxString &aPadNumber, PAD *aSearchAfterMe=nullptr) const
Return a PAD with a matching number.
Definition: footprint.cpp:1012
const wxString & GetReference() const
Definition: footprint.h:430
#define _(s)
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
const std::string & GetString()
Definition: richio.h:438
void SetHighLightNet(int aNetCode, bool aMulti=false)
Select the netcode to be highlighted.
Definition: board.cpp:2030
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: box2.h:363
std::string FormatProbeItem(BOARD_ITEM *aItem)
bool zoom_to_fit
Zoom to fit items (ignored if center_on_items is off)
Definition: app_settings.h:33
Store all of the related footprint information found in a netlist.
Definition: pcb_netlist.h:84
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
const std::set< int > & GetHighLightNetCodes() const
Definition: board.h:386
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Set the scaling factor, zooming around a given anchor point.
Definition: view.cpp:555
void SendMessageToEESCHEMA(BOARD_ITEM *objectToSync)
Send a message to the schematic editor so that it may move its cursor to a symbol with the same refer...
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
bool auto_highlight
Automatically turn on highlight mode in the target frame.
Definition: app_settings.h:34
Handle the data for a net.
Definition: netinfo.h:64
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition: box2.h:281
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:158
void SetHighlight(bool aEnabled, int aNetcode=-1, bool aMulti=false)
Turns on/off highlighting.
Vec Centre() const
Definition: box2.h:63
static TOOL_ACTION selectOnSheetFromEeschema
Select all components on sheet from Eeschema crossprobing.
Definition: pcb_actions.h:83
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
const EDA_RECT GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: footprint.cpp:676
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...
PCBNEW_SETTINGS * GetPcbNewSettings() const
coord_type GetHeight() const
Definition: box2.h:181
void AddNet(const wxString &aPinName, const wxString &aNetName, const wxString &aPinFunction, const wxString &aPinType)
Definition: pcb_netlist.h:103
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:97
#define DEFAULT_TEXT_SIZE
Ratio of the font height to the baseline of the text above the wire.
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:54
BOARD * GetBoard() const
CROSS_PROBING_SETTINGS m_CrossProbing
Definition: app_settings.h:167
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
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.
Definition: pad.h:57
MAIL_T Command()
Returns the MAIL_T associated with this mail.
Definition: kiway_express.h:49
void UpdateAllLayersColor()
Apply the new coloring scheme to all layers.
Definition: view.cpp:775
double GetScale() const
Definition: view.h:264
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:166
bool center_on_items
Automatically pan to cross-probed items.
Definition: app_settings.h:32
Implement an OUTPUTFORMATTER to a memory buffer.
Definition: richio.h:414
static constexpr int Millimeter2iu(double mm)
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75
void SetDeleteUnusedFootprints(bool aEnabled)
std::string & GetPayload()
Return the payload, which can be any text but it typically self identifying s-expression.
Definition: kiway_express.h:57
bool IsSingle() const
Is this KIFACE running under single_top?
Definition: kiface_base.h:104
TRACKS & Tracks()
Definition: board.h:230
FOOTPRINT * FindFootprintByReference(const wxString &aReference) const
Search for a FOOTPRINT within this board with the given reference designator.
Definition: board.cpp:1365
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113
int GetNetCode() const
Definition: netinfo.h:113
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:293